Avatar for user76916

user76916

Member since May 2017 • Last active Jul 2017
  • 2 conversations
  • 5 comments

Most recent activity

    • 7 comments
    • 210 views
  • Avatar for user76916

    Hi there,

    So, if you have a require statement, you have to write the statement (or your code) on the right side of IDE and upload. This process downloads any dependency from the internet and uploads them correctly to the device. You will get a module not found error if you write a require statement in the REPL.
    A typical program would then have an onInit() function and a save() statement at the end of file for persistence.
    The modules are downloaded from https://github.com/espruino/EspruinoDocs­/tree/master/devices
    A typical program would look like this-

    clearWatch();
    var wifi;
    var werr;
    let WIFI_NAME = 'something';
    let WIFI_OPTIONS = { password: 'something' };
    let w_conn = 0;
    
    function onInit() {
      console.log('here');
      connWiFi().then(succ => {
        w_conn = 1;
        console.log('connected !');
        digitalPulse(LED2, 1, 100);
      }, err => {
        werr = err;
        console.log('some error in wifi connection');
      });
    }
    function connWiFi() {
      let prom = new Promise((res, rej) => {
        wifi = require('EspruinoWiFi');
        wifi.connect(WIFI_NAME, WIFI_OPTIONS, err => {
          if(err) rej(err);
          else res(1);
        });
      });
      return prom;
    }
    save();
    
  • Avatar for user76916

    Oh I got you. I was directly using screen on my mac assuming the firmware has that js module. :)
    Thank you so much !

  • Avatar for user76916

    Hi,

    When I enter on my Espruino WiFi

    var wifi = require("EspruinoWiFi");
    

    I get the error,

    ERROR: SD card must be setup with E.connectSDCard first
    WARNING: Module "EspruinoWiFi" not found
    =undefined
    

    The firmware is 1v91. Any help appreciated on whether this is a hardware or software issue.

    Thanks.

  • in Puck.js
    Avatar for user76916

    Ah ok. Cool. Yes I do have the latest firmware as you mention.
    I think the error is reproducible. But as you mention, I will change the setAdvertising.

    Happy holidays !

    PS - Great work :)

    • 3 comments
    • 106 views
  • in Puck.js
    Avatar for user76916

    I have an application where the Puck sends data through BLE write on another device.
    To reduce power consumption even more, I tried turning off NRF by NRF.sleep() (The example here works https://github.com/espruino/EspruinoDocs­/blob/master/puck/Puck.js%20Security.md#­disable-bluetooth)

    However, when I modify the code to enable sleep after performing some action, the Puck lights up all 3 LEDs and my function does not work again. Here is a sample pseudo code -

    var locked = 0;
    setWatch(function(){
    NRF.wake();
    digitalPulse(LED2, 1, 50);
    /*
    do something here
    */
    setTimeout(() => NRF.sleep(), 1000); // turns on all 3 LEDs briefly and resets.
    }, BTN, {repeat:true, edge:"rising", debounce:50});

    Any suggestions why is this happening ?

Actions