• Ok, I just created an example for you that should work:

    # based on https://github.com/rlangoy/bluepy_exampl­es_nRF51822_mbed/blob/master/writeLed2.p­y
    import sys
    from bluepy.btle import UUID, Peripheral
    
    if len(sys.argv) != 2:
      print "Fatal, must pass device address:", sys.argv[0], "<device address="">"
      quit()
    
    p = Peripheral(sys.argv[1], "random")
    UartService=p.getServiceByUUID(UUID("6E4­00001-B5A3-F393-E0A9-E50E24DCCA9E"))
    ch = UartService.getCharacteristics(UUID("6E4­00002-B5A3-F393-E0A9-E50E24DCCA9E"))[0]
    # \x03 -> Ctrl-C clears line
    # \x10 -> Echo off for line so don't try and send any text back
    ch.write("\x03\x10LED.toggle()\n");
    p.disconnect()
    

    In your case the text you want to write will be more than 20 characters, so you'll need to write it in 20 character chunks

About

Avatar for Gordon @Gordon started