Avatar for Gordon

Gordon

Member since Sep 2013 • Last active Mar 2017

Most recent activity

  • in Puck.js
    Avatar for Gordon

    Also, you can just type save() on the left-hand side when you have everything as you want it.

    • Save on send -> saves your actual JS code to Espruino and runs it at startup
    • save() -> saves an image of the current state of the interpreter to flash. If you've tweaked something on the left hand side and want to keep what you've done, use that.
  • in Pico / Wifi / Original Espruino
    Avatar for Gordon

    I don't think it is possible at the moment.

    However, if you're connecting over a WEP access point the ESP8266 has created, that is itself encrypted so I think the chances of snooping are pretty much zero.

  • in Puck.js
    Avatar for Gordon

    That's correct, yes. There's some good info on where to look here, after the list of tutorials: espruino.com/Puck.js+Quick+St­art#what-now-

    Basically, you have:

    • Puck Object - for Puck.js specific functionality
    • NRF Object - for nRF52 Bluetooth functionality
    • Global Functions and E Object - for built-in Espruino functionality

    How to use the onboard peripherals is documented here as well: espruino.com/Puck.js#on-board­-peripherals

  • in Projects
    Avatar for Gordon

    I just got a chance to try this - looks nice!

    I guess for something pre-installed, people won't actually see any of the text that appears (initially) - and when they get to that point they could easily have loaded up your code themselves.

    (just an aside, but if I added https://www.espruino.com/ide/#code_url_h­ere it could be really helpful for posting up code?)

    So I'm wondering what we could do 'out of the box' - when you first insert the battery and do nothing else - that would be fun, and that didn't drain the battery for those that turn the Puck on and then just leave it (including if they put it in a bag and the button kept being pressed).

    The rainbow is nice, and maybe it could detect rotation using the magnetometer.

    Perhaps it could flash out rainbow colours in 4 groups of pulses, where the number of pulses corresponded with the Puck's MAC address that was displayed when advertising?

    It'd be nice to it to be able to connect to Pucks that are very close (high signal strength) and make them flash or something - but I think in a classroom environment that would just be more annoying than anything else :)

    I guess after an hour of not being used it could just completely clear itself so it went back to not using much power?

  • in JavaScript
    Avatar for Gordon

    How about changing your existing callback:

    dht.read(function (a) {Temp = a.temp.toString();Humidity = a.rh.toString();});
    

    to:

    dht.read(function (a) {
      Temp = a.temp.toString();
      Humidity = a.rh.toString();
      sendForm(Temp, Humidity);
    });
    

    So now you send the form as soon as you have the information ready?

  • in Pico / Wifi / Original Espruino
    Avatar for Gordon

    You could just store the Wifi credentials in RAM so that they are lost on power-off if that is a real concern? However I imagine the vast majority of consumer electronics will store your WiFi details in plain text :)

  • in JavaScript
    Avatar for Gordon

    Just opening this again to mention this page, which has your answer: github.com/espruino/Espruino/blo­b/master/libs/README.md

  • in Pico / Wifi / Original Espruino
    Avatar for Gordon

    Hi, What I'd suggest is that soon after power-on you detect if the button is pressed, and if it is you put the WiFi module into access point mode with wifi.createAP("ESP123","HelloWorld",5,"w­pa2_psk",function() { now connected ... })

    You can then create a webserver which serves up a page where the wifi credentials are entered - and you can store those credentials using require("FlashEEPROM").write.

    Then, when you boot up without the button pressed, read credentials using require("FlashEEPROM").read and connect to that WiFi network.

    Either that, or if this is a toy and it needs controlling (but not an internet connection) you could just always make it create its own access point rather than connecting to another network?

  • in ESP32
    Avatar for Gordon

    Ok, thanks - and it's still sending the correct data? That line might be sending the correct length, but I'm not sure if the data will be correct.

    this.socket.write(E.toString(m8).substr(­0,(4 + msg.length))); might be better, but it may hurt performance a bit.

  • in Pico / Wifi / Original Espruino
    Avatar for Gordon

    No problem! It's pretty common as people tend to forget to mention it, and even circuit diagrams often leave out a connecting wire for it because they assume GND is always connected together :)

    On most things you need GND connected. A voltage isn't really absolute - you (and the microcontrollers) need to measure it relative to something else. It's like me showing you where the top of my head is and asking you to measure my height - it's impossible unless you can also measure from where my feet are.

Actions