• Ok, or code that actually does the splitting for you:

    # 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()
    
    # \x03 -> Ctrl-C clears line
    # \x10 -> Echo off for line so don't try and send any text back
    # command = "\x03\x10reset()\nLED.toggle()\n"
    command = "\x03\x10clearInterval()\n\x10setInterva­l(function() {LED.toggle()}, 500);\n"
    
    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]
    while len(command)>0: 
      ch.write(command[0:20]);
      command = command[20:];
    p.disconnect()
    
About

Avatar for Gordon @Gordon started