Avatar for Bernd

Bernd

Member since Oct 2018 • Last active Jul 2019
  • 2 conversations
  • 7 comments

hoping to use Espruino in education outreach projects (primary and secondary)

Most recent activity

    • 11 comments
    • 619 views
  • in Other Boards
    Avatar for Bernd

    That’s good to hear. In that case it’s probably better to use the UART. Thanks!

  • in Other Boards
    Avatar for Bernd

    thanks, Gordon.
    I actually have a few old Androids lying around. Maybe I'll try that.

    On a related matter: I need to transfer larger amounts of data via the BLE connection (offline data logging). From studying the web resources, the normal approach (see here) appears to sequentially write to a characteristic, exploiting the events / exceptions

    BLE_ERROR_NO_TX_BUFFERS and
    BLE_EVT_TX_COMPLETE

    These don't seem to be exposed in the NRF library. What do you recommend? (I think I could exploit the UART interface, but I would like to be able to implement the same protocol on non-Espruino devices later so that I don't have to change the central side).

    Thanks!

  • in Other Boards
    Avatar for Bernd

    Oh, great. Thanks for the quick response. Switching Bluetooth on and off actually solved the problem!

    I found a note in the meantime that the Bluetooth SIG requires a service 0x1801: { // generic attribute service with charactersitic 0x2A05: { // service changed characteristic to be present (and I assume with value true) if the services on a device can change.

    I tried to set this, as part of my code using

    NRF.setServices({
      0x1801: { // generic attribute service
        0x2A05: { // service changed characteristic
          notify: true,
          readable: true,
          value : [true]
        }
      }
    });
    

    but this didn't produce any effect. I suppose at that point it's already too late? Would it be possible to put that into the default profile?

  • in Other Boards
    Avatar for Bernd

    I can't get Thingy to provide a GATT service. After reading everything I could find online, I still have no idea what I could be doing wrong.

    Advertising work fine, I can see the 0x180D service in the advertisement (I'm using NRFconnect on iOS to check, but have the same effect with other tools as well).

    But when I connect only the standard UART RX and TX services are visible. Nothing else.

    The code below is taken from another stream and appeared to work on a Ruuvitag. (I've tried various versions, but without any change in effect).


    NRF.setServices({
      0x180D: { // heart_rate
        0x2A6E: { // heart_rate_measurement
          notify: true,
          readable: true,
          value : [0]
        }
      }
    }, { advertise: [0x180D], uart: false });
    
    
    var cnt = 0;
    
    setWatch(function() {
      if(cnt++ % 2 === 0)
        LED1.set();
      else
        LED1.reset();
      NRF.updateServices({
        0x180D : {
          0x2A6E : {
            value : [cnt],
            notify: true
          }
        }
      });
    }, BTN, { repeat:true, edge:"rising", debounce: 50 });
    

    The LED toggles just fine, so obviously the function gets called.

    And, yes, I do disconnect the Web Bluetooth IDE from Thingy before I check the services.

    Any help would be much appreciated!
    Thanks,

    Bernd

  • in Other Boards
    Avatar for Bernd

    Thanks for the swift reply, Gordon!
    Very cool, I didn't realise you could do this without using anything Thingy-specific!
    Just flashed one of my Thingies with Espruino. Exciting!

  • in Other Boards
    Avatar for Bernd

    Hi All,

    i was hoping to be able to use Espruino to query some external sensors on Thingy:52

    The basic idea is to connect an external analogue sensor, say soil moisture, to Thingy and let Thingy broadcast the sensor readings.

    Very much like a combination of what is done with the Pico here to connect an external light sensor: https://www.espruino.com/Pico+Light+Sens­or and the Thingy here to let it broadcast sensor values: https://www.espruino.com/Pixl.js+Wireles­s+Weather+Station

    The Espruino-Thingy page at https://www.espruino.com/Thingy52#on-boa­rd-peripherals
    seems to suggest this is possible (Section "On BOard Peripherals") via
    // External IO outputs
    IOEXT0/1/2/3

    However, I can find no further documentation/ tutorials on how to actually read the sensor values.

    Any pointers to further information would be very much appreciated!

    Thanks.

    Bernd

Actions