From 001111d0677dd730d2467663fa3acb5f15951fe6 Mon Sep 17 00:00:00 2001 From: Arti Zirk Date: Sun, 3 Nov 2024 20:38:26 +0200 Subject: [PATCH] Add more instructions --- README.md | 9 +++++++++ main.py | 10 ++++++++++ 2 files changed, 19 insertions(+) diff --git a/README.md b/README.md index 0e6981b..4ec68ac 100644 --- a/README.md +++ b/README.md @@ -3,3 +3,12 @@ Uses stock MicroPython firmware running on ESP8266 Wemos D1 Arduino or D1 Mini * https://micropython.org/download/ESP8266_GENERIC/ + +# Usage + +1. Get latest MicroPython and name it `sumofirmware.bin` +2. Edit `config.json` with the target sumorobot ID (MAC last 6 hexdets) +3. Run `make` to flash and configure the remote + +The remote will now connect to the `sumo` wifi and will do a DNS lookup against `sumo-` +to find the target IP address and then will start blasting UDP packets against it diff --git a/main.py b/main.py index d7f9bc9..04ea3ae 100644 --- a/main.py +++ b/main.py @@ -7,8 +7,17 @@ while not wlan.isconnected(): sleep_ms(100) adc = ADC(0) + +# Wemos D1 Mini (277010) +# Pin 16 forward pin 4 backwards +#forward = Pin(0, Pin.IN) +#backward = Pin(2, Pin.IN) + +# Wemos D1 Normal Arduino +# Pin 16 forward pin 4 backwards forward = Pin(16, Pin.IN) backward = Pin(4, Pin.IN) + calibration = adc.read() sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) # UDP @@ -29,5 +38,6 @@ print("Sending packets to", sockaddr) while True: msg = "%d:%d:%d" % (adc.read()-calibration, not forward.value(), not backward.value()) + print(msg) sock.sendto(msg.encode("ascii"), sockaddr) sleep_ms(30)