### fernsteuerung ESPNow test from robocar2w import * halt() import network, espnow, binascii, time, machine led = machine.Pin(2,machine.Pin.OUT) wlan_sta = network.WLAN(network.STA_IF) wlan_sta.active(True) mac = wlan_sta.config('mac') print("\n\nMeine MAC: ", mac, " = ", binascii.hexlify(mac).decode() , "\n") e = espnow.ESPNow() e.active(True) peer = b'\xff' * 6 # Broadcast-Adresse für alle - funktioniert print("peer-MAC: ",peer, " = ", binascii.hexlify(peer).decode()) e.add_peer(peer) ende = False while not ende: print("Warte auf nachricht") eingabe="" host, msg = e.irecv(1000) # ms bis timeout if msg: print(host, msg) eingabe = msg.decode() print(eingabe) led.value(not led.value()) # eingabe = input("Befehle: ") if eingabe=="": continue if eingabe == "x": ende = True elif eingabe == "0": halt() else: werte = eingabe.split(" ") l = len(werte) print("l = ", l, werte) if l==1: fahre(werte[0]) elif l==2: fahre(werte[0], werte[1]) else: pass # --- Ende While not ende --- halt() print("Programm beendet!")