My Program runs in an endless-loop where the ESP32 sleeps for some ms and is awake for some ms.
When the ESP32 is awake scans the bluetooth.
But the ESP32 reboots all the time. After hours and also after a few minutes.
Here is my main.py:
Code: Select all
def ble_irq(event, data):
#print(event)
#print(data)
if event == const(5): # scan result
if data[4] == bytearray(b'TEST01'):
ble.gap_scan(None)
#make some stuff
ble.gap_scan(0, 100000, 100000)
ble = bt.BLE()
ble.irq(ble_irq)
ble.active(True)
ble.gap_scan(0, 100000, 100000)
while True:
time.sleep_ms(300)#BLE scannen
machine.lightsleep(200)#machine sleep