• 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("6E4­00001-B5A3-F393-E0A9-E50E24DCCA9E"))
            ch = UartService.getCharacteristics(UUID("6E4­00002-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-00000­0000000")
            [#lightSensorValue](https://forum.esprui­no.com/search/?q=%23lightSensorValue) = lightService.getCharacteristics(uuidValu­e)[0]
       
            val = ch.read()
            print "response value", val
    
            p.disconnect()
    finally:
            p.disconnect()
    
About

Avatar for Ossama @Ossama started