Avatar for billsalt

billsalt

Member since Jan 2017 • Last active May 2017
  • 6 conversations
  • 34 comments

Most recent activity

  • in Puck.js
    Avatar for billsalt

    Hi @Gordon- did you have a chance to try the example above? I'm curious if you (or others) repeat my issues and especially if there is a solution. Thanks!
    Bill

  • in Puck.js
    Avatar for billsalt

    Hi @Gordon,
    Tried your suggestions above to no avail. I have a nice test bench using two puck-js devices as follows: set up one using the LBS (LightButtonService) I published several months ago. Set up the other to find and set the LED. Here's the code; I've verified that the LBS is still working as advertised (pun intended).

    I get either no service found or an IDE disconnect, sometimes requiring I pull the battery to reset the (finder) device.

    Let me know if you get the same/different results, THANKS!

    LBS code:

    NRF.setAdvertising({}, {name: "Nordic_Blinky"});
    
    pinMode(D5, "output");
    pinMode(D6, "output");
    pinMode(D7, "output");
    pinMode(D31, "output");
    pinMode(D16, "input");
    
    NRF.setServices({
      "00001523-1212-EFDE-1523-785FEABCD123" : {
        "00001524-1212-EFDE-1523-785FEABCD123" : { // button
          value : 0x00, // optional
          broadcast : false, // optional, default is false
          readable : true,   // optional, default is false
          writable : false,   // optional, default is false
          notify : true,   // optional, default is false
          indicate : false,   // optional, default is false
        },
        
        "00001525-1212-EFDE-1523-785FEABCD123" : { // LED
          value : 0x00, // optional
          broadcast : false, // optional, default is false
          readable : true,   // optional, default is false
          writable : true,   // optional, default is false
          notify : false,   // optional, default is false
          indicate : false,   // optional, default is false
                onWrite : function(evt) {
            digitalWrite([D5,D6,D31,D7], evt.data[0]);
                }
        }
        
      }
    });
    
    setWatch(function() {
      NRF.updateServices({
      "00001523-1212-EFDE-1523-785FEABCD123" : {
        "00001524-1212-EFDE-1523-785FEABCD123" : {
          value : 0x01,
          notify: true
        }
      }
    });
    }, D16, {edge:"rising", debounce:50, repeat:true});
    
    
    setWatch(function() {
      NRF.updateServices({
      "00001523-1212-EFDE-1523-785FEABCD123" : {
        "00001524-1212-EFDE-1523-785FEABCD123" : {
          value : 0x00,
          notify: true
        }
      }
    });
    }, D16, {edge:"falling", debounce:50, repeat:true});
    

    Finder code:

    var devices;
    
    NRF.findDevices(function(devices) {
      if (devices.length < 1) throw new Error("Nothing found!");
      devices[0].gatt.connect().then(function(­g) {
        gatt = g;
        return gatt.getPrimaryService("00001523-1212-EF­DE-1523-785FEABCD123");
      }).then(function(service) {
        return service.getCharacteristic("00001525-1212­-EFDE-1523-785FEABCD123");
      }).then(function(characteristic) {
        characteristic.writeValue( [0xff] );
      }).then(function() {
        gatt.disconnect();
        console.log("Done!");
      });
    }, 4000);
    
  • in Puck.js
    Avatar for billsalt

    The IDE is running on MacOS, correct. The code I posted is exactly what I'm running on a completely reset and restored device (both with released and experimental Espruino). I'll try a different (128-bit) characteristic on another device, good suggestion, although LightBlue on both iOS and MacOS work just fine with it. I'll also try the more explicit representation you suggest.

    The truly maddening thing is that I've actually seen it work twice, but can't repeat it with any predictability! Thanks @Gordon!

  • in Puck.js
    Avatar for billsalt

    @zarconi No. That profile is on Bluetooth Classic. I doubt the 3G modem supports Bluetooth low energy which is the only thing the puck 'speaks'. It may/may not expose a modem serial port profile on Bluetooth Classic (also called BR/EDR).

  • in Puck.js
    Avatar for billsalt

    @Gordon I'll look into the serial console connection. I have 14-18 devices within range, but went to a coffee shop where I was able to reduce that to 6 (too many fitness devices) and had similar results. The connection works just fine with an iOS, MacOS using LightBlue and my custom apps, so this is an issue I'm having solely with these espruino-based devices. I've had noble-based javascript application work using raspberry pi as well. Bottom line, it isn't a technology issue IMHO.

    Any additional debugging thoughts from you (or the community) would be greatly appreciated. There are several reasons I'd like to get espruino working for this. THANKS!

  • in Puck.js
    Avatar for billsalt

    @Gordon one thought: could there be an issue with the number of devices returning information (buffer overflows)? I have at least a dozen BLE devices in my environment. I'll try to find an isolated coffee shop (though lots of devices show up now) to test this theory, but thought I'd pass this on in case there is a way to increase resources.

  • in Puck.js
    Avatar for billsalt

    Battery is 100%. I reloaded with 1v92 release and similar behavior: not finding the service sometimes, and sometimes hanging and dropping the IDE. I haven't caught the LED blinking, though sometimes I have to pull the battery to reset to get the IDE connected again. Is there a serial debugger operating that I can catch? Any other ideas?

  • in Puck.js
    Avatar for billsalt

    @Gordon trying another method, by mac address. Also disconnects from IDE without changing the characteristic:

    var gatt;
    NRF.connect("d4:df:0a:04:44:03").then(fu­nction(g) {
      gatt = g;
      return gatt.getPrimaryService("bbc21523-008e-fe­6b-28ee-d6a44f9cb5da");
    }).then(function(service) {
      return service.getCharacteristic("bbc21525-008e­-fe6b-28ee-d6a44f9cb5da");
    }).then(function(characteristic) {
      characteristic.writeValue(0xff);
    }).then(function() {
      gatt.disconnect();
      console.log("Done!");
    });
    
Actions