Hi! As I understand it, simblee had characteristics predefined that would change the state of pins when you wrote to them.
Espruino is a bit more flexible - you can either write JavaScript code directly to the UART characteristic or you can make Espruino itself behave like simblee:
This will create a characteristic with uuid 35ac0002-18b0-e8b7-3feb-62cec301da00 that will write to all the pins of the MDBT42 module based on the 3 bytes you send to it.
disconnect and use gatttool:
$ gatttool --device=fc:cc:b8:22:b0:42 --addr-type=random -I
[fc:cc:b8:22:b0:42][LE]> connect
Attempting to connect to fc:cc:b8:22:b0:42
Connection successful
[fc:cc:b8:22:b0:42][LE]> char-desc
handle: 0x0001, uuid: 00002800-0000-1000-8000-00805f9b34fb
handle: 0x0002, uuid: 00002803-0000-1000-8000-00805f9b34fb
handle: 0x0003, uuid: 00002a00-0000-1000-8000-00805f9b34fb
handle: 0x0004, uuid: 00002803-0000-1000-8000-00805f9b34fb
handle: 0x0005, uuid: 00002a01-0000-1000-8000-00805f9b34fb
handle: 0x0006, uuid: 00002803-0000-1000-8000-00805f9b34fb
handle: 0x0007, uuid: 00002a04-0000-1000-8000-00805f9b34fb
handle: 0x0008, uuid: 00002803-0000-1000-8000-00805f9b34fb
handle: 0x0009, uuid: 00002aa6-0000-1000-8000-00805f9b34fb
handle: 0x000a, uuid: 00002800-0000-1000-8000-00805f9b34fb
handle: 0x000b, uuid: 00002800-0000-1000-8000-00805f9b34fb
handle: 0x000c, uuid: 00002803-0000-1000-8000-00805f9b34fb
handle: 0x000d, uuid: 6e400003-b5a3-f393-e0a9-e50e24dcca9e
handle: 0x000e, uuid: 00002902-0000-1000-8000-00805f9b34fb
handle: 0x000f, uuid: 00002803-0000-1000-8000-00805f9b34fb
handle: 0x0010, uuid: 6e400002-b5a3-f393-e0a9-e50e24dcca9e
handle: 0x0011, uuid: 00002800-0000-1000-8000-00805f9b34fb
handle: 0x0012, uuid: 00002803-0000-1000-8000-00805f9b34fb
handle: 0x0013, uuid: 35ac0002-18b0-e8b7-3feb-62cec301da00
[fc:cc:b8:22:b0:42][LE]> char-write-req 0x0013 000001 <----------- LED1 turns on
Characteristic value was written successfully
[fc:cc:b8:22:b0:42][LE]> char-write-req 0x0013 000002 <----------- LED2 turns on
Characteristic value was written successfully
[fc:cc:b8:22:b0:42][LE]> char-write-req 0x0013 000002 <----------- both LEDS turns on
Characteristic value was written successfully
[fc:cc:b8:22:b0:42][LE]> char-write-req 0x0013 000000 <----------- both LEDS turns off
Characteristic value was written successfully
So you could make this work in a very similar way to simblee - however chances are the characteristic handles would be different even if you made the UUIDs the same.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Hi! As I understand it, simblee had characteristics predefined that would change the state of pins when you wrote to them.
Espruino is a bit more flexible - you can either write JavaScript code directly to the UART characteristic or you can make Espruino itself behave like simblee:
JavaScript
Here you use 0x0010 because that's the handle for uuid 6e400002-b5a3-f393-e0a9-e50e24dcca9e which is the Nordic UART transmit characteristic.
4c45442e746f67676c6528290a
is the hex value of"LED.toggle()\n"
which you get using the JavaScript code:So you could change this to
D3.write(1)\n
for instance to change the state of pin D3.Simblee clone
Upload this code:
This will create a characteristic with uuid
35ac0002-18b0-e8b7-3feb-62cec301da00
that will write to all the pins of the MDBT42 module based on the 3 bytes you send to it.disconnect and use gatttool:
So you could make this work in a very similar way to simblee - however chances are the characteristic handles would be different even if you made the UUIDs the same.
Hope that helps!