wifi.setHostname, or setIp on Espy WIFI #4896
Replies: 1 comment
-
Posted at 2020-06-23 by mattw If it's not clear, the user turns on the tape recorder, Espy boots, they go to a local domain or IP they know, and we have a front end JS app served from there. That JS app essentially controls the output pins of the Espy which control the tape recorder. Posted at 2020-06-24 by @gfwilliams That looks great! If it helps, you can use a templated string for the HTML...
Which makes things tidier. Setting a DNS name is much harder I'm afraid. It is possible to update the ESP8266 (wifi module) firmware to enable this, but out of the box it isn't supported. The easiest thing you can do is to set the IP address. You should be able to replace the
And then you'll always have the ESP8266 at a set IP address. Posted at 2020-06-24 by @gfwilliams If you're interested, info on enabling MDNS with new WiFi firmwares is in: http://forum.espruino.com/conversations/293972/#14954189 Posted at 2020-06-24 by mattw Actually stand by. I want to make sure I am doing this right. Posted at 2020-06-24 by mattw I'm on firmware 2v05 I believe-- I updated yesterday in fact. Posted at 2020-06-24 by mattw Okay Gordon, I'm really not getting it. Here is the Github for what we got goin: https://github.com/giokincade/autolocatorjs.git The current file I am deploying is mw-test.js. The relevant code is:
I checked that it's syntactically valid, etc.-- seems fine. But the Espy is throwing an error w underlying code, I believe. And it is looping the upload process. Here's one cycle. Also, I'm including my deploy process as well. I'm a newbie so some basic mistake is totally possible.
What am I doing wrong here? For what it's worth, our initial test.js works:
The setIP part of this is causing the failure. I don't get it. Any ideas? Posted at 2020-06-25 by @gfwilliams Sorry, that's totally my fault - a copy/paste error. You actually needed:
So without the extra Posted at 2020-06-25 by mattw Cool. Now it works! Thank you Gordon! So, what were you saying earlier about templating the HTML? Posted at 2020-06-26 by @gfwilliams Great... So literally just:
It's just tidier, and especially if you're writing more HTML it'll make things a lot easier :) |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Posted at 2020-06-23 by mattw
Hi guys--
I'm writing an application to control an analog tape recorder (Otari MTR-90 MK2, if you're curious.). We created a successful alpha with Arduino UNO and some complex add-on shields, and it's basically working, but we think Espruino Wifi can we do everything we need, and keep it all happily in the land of JS. Plus it's way smaller.
However, we will need to set a hostname, or at the very least an ip address. The Espy will be mounted to the machine and derive power from a voltage regulator fed by the machine-- so basically, it'll boot up when the machine is powered on. There's no direct feedback to the user. I can get a little hello world going, but I can't get the DNS to set.
This is working code, below. Any attempt at setHostname or setIp causes various failures. I'm on firmware 2v05.
THANKS!
Beta Was this translation helpful? Give feedback.
All reactions