Thanks Gordon,
i am using the following function on the puck, and ideally i would like to return something back to my python script. i.e temperature value.
function beam(ircode) { Puck.IR(require("pronto").decode(ircode)); return "test"; }
see below my python code as wel. i am so far getting the following value back from the puck, or is it not from the puck hhh
response value beam(sleep);
import sys from bluepy.btle import UUID, Peripheral import time import binascii command = "\x03\x10beam(" +sys.argv[2]+ ");\n" p = Peripheral(sys.argv[1], 'random') try: UartService=p.getServiceByUUID(UUID("6E400001-B5A3-F393-E0A9-E50E24DCCA9E")) ch = UartService.getCharacteristics(UUID("6E400002-B5A3-F393-E0A9-E50E24DCCA9E"))[0] while len(command)>0: ch.write(command[0:20]); command = command[20:]; time.sleep(1.0) # Allow sensor to stabilise [#uuidValue](https://forum.espruino.com/search/?q=%23uuidValue) = btle.UUID("f000aa71-0451-4000-b000-000000000000") [#lightSensorValue](https://forum.espruino.com/search/?q=%23lightSensorValue) = lightService.getCharacteristics(uuidValue)[0] val = ch.read() print "response value", val p.disconnect() finally: p.disconnect()
@Ossama started
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.
Thanks Gordon,
i am using the following function on the puck, and ideally i would like to return something back to my python script. i.e temperature value.
see below my python code as wel. i am so far getting the following value back from the puck, or is it not from the puck hhh