You are reading a single comment by @Jonathan and its replies. Click here to read the full conversation.
  • Hey fanoush,
    thanks for the reply! I now tried to remove the startBonding step but if I omit that, nothing happens on the Device despite all other actions succeding.

    Here is the complete code I use to control the device. Maybe there are some steps that I could remove or speed up to save time, I'd be very grateful for any hints (or also JS best practice remarks, I haven't worked with JS before). Also, does console.log take up alot of time?

    NRF.connect(ST_ADDRESS).then(function connectComplete(connection){
    	st = connection;
      console.log("Connected to", connection);
      return st.device.gatt.connect();
    }).then(function(gatt) {
      st_gatt = gatt;
      console.log("connected");
      return st_gatt.startBonding(false);
    }).then(function() {
      console.log("bonded", st_gatt.getSecurityStatus());
      return st.getPrimaryService("51361500-c5e7-47c7-8a6e-47ebc99d80e8");
    }).then(function serviceComplete(service){
      st_service = service;
      console.log("Got Service", service);
      return service.getCharacteristic("51361501-c5e7-47c7-8a6e-47ebc99d80e8");
    }).then(function statusComplete(data) {
      st_status = data; 
      console.log("Status Success", st_status);
      return st_service.getCharacteristic("51361502-c5e7-47c7-8a6e-47ebc99d80e8");
    }).then(function statusComplete(data) {
      st_motor = data; 
      console.log("Motor Success", st_motor);
    ).then(function start() {
      return st_status.writeValue([1]); //Send enable byte
    }).then(vibrate, console.log);
    
    

    I've heard about the security risks associated with these devices if nrf dfu remains possible, however this particular device (plug-ilicous 2) seems to use a realtek ic. Although I love the idea of a buttplug running js (the most direct way to tell someone to shove JS up their ass...) :D

About

Avatar for Jonathan @Jonathan started