You are reading a single comment by @migsanvi and its replies. Click here to read the full conversation.
  • Hi at all!

    I am working on a project that uses the HID features on BLE. In particular, I want to send a character (volume up) each time a button is pressed. This is my code:

    var controls = require("ble_hid_controls");
    
    // Clean all previous watches
    clearWatch();
    
    NRF.setServices(undefined, {hid: controls.report});
    
    setWatch(function (ptt) {
      if (ptt.state) {
        LED2.set();
        NRF.sendHIDReport(32, () => {});
      } else {
        LED2.reset();
        NRF.sendHIDReport(0, () => {});
      }
    }, BTN, {edge: "both", debounce: 50, repeat: true});
    

    To save the program I follow this step:

    1. In Espruino Web IDE, configure the option Save on send - Direct to flash (execute code at boot).
    2. Upload the code.
    3. Disconnect from the PC
    4. Connect to device and work.

    But when I remove the battery and put it back on (without pressing BTN), the three LEDs start flashing at the same time and the program does not work and any device recognize it (PC or mobile) until I do a Hard reset.

    Can anyone tell me what it means to have the three LEDs blink at the same time?
    What can I do to save my program and not be deleted when I change the battery?

    Thank you very much in advance

About

Avatar for migsanvi @migsanvi started