Add more instructions
This commit is contained in:
parent
ecf8dcb015
commit
001111d067
@ -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-<ID>`
|
||||
to find the target IP address and then will start blasting UDP packets against it
|
||||
|
10
main.py
10
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)
|
||||
|
Loading…
Reference in New Issue
Block a user