Add more instructions

This commit is contained in:
Arti Zirk 2024-11-03 20:38:26 +02:00
parent ecf8dcb015
commit 001111d067
2 changed files with 19 additions and 0 deletions

View File

@ -3,3 +3,12 @@
Uses stock MicroPython firmware running on ESP8266 Wemos D1 Arduino or D1 Mini Uses stock MicroPython firmware running on ESP8266 Wemos D1 Arduino or D1 Mini
* https://micropython.org/download/ESP8266_GENERIC/ * 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-<ID>`
to find the target IP address and then will start blasting UDP packets against it

10
main.py
View File

@ -7,8 +7,17 @@ while not wlan.isconnected():
sleep_ms(100) sleep_ms(100)
adc = ADC(0) 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) forward = Pin(16, Pin.IN)
backward = Pin(4, Pin.IN) backward = Pin(4, Pin.IN)
calibration = adc.read() calibration = adc.read()
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) # UDP sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) # UDP
@ -29,5 +38,6 @@ print("Sending packets to", sockaddr)
while True: while True:
msg = "%d:%d:%d" % (adc.read()-calibration, not forward.value(), not backward.value()) msg = "%d:%d:%d" % (adc.read()-calibration, not forward.value(), not backward.value())
print(msg)
sock.sendto(msg.encode("ascii"), sockaddr) sock.sendto(msg.encode("ascii"), sockaddr)
sleep_ms(30) sleep_ms(30)