import bluetooth from time import sleep from ble_advertising import advertising_payload from ble_simple_peripheral import BLESimplePeripheral ble = bluetooth.BLE() p = BLESimplePeripheral(ble) i = 0 while(1): if p.is_connected(): i += 1 data = str(i) p.send(data + "\r\n") print("tx ", data) sleep(1)