ch-9 clean
This commit is contained in:
@@ -5,10 +5,10 @@ from adafruit_esp32spi import adafruit_esp32spi
|
|||||||
from adafruit_esp32spi import adafruit_esp32spi_wifimanager
|
from adafruit_esp32spi import adafruit_esp32spi_wifimanager
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from secrets import secrets
|
from secrets import secrets
|
||||||
except ImportError:
|
except ImportError:
|
||||||
print("WiFi secrets are kept in secrets.py, please add them there!")
|
print("WiFi secrets are kept in secrets.py, please add them there!")
|
||||||
raise
|
raise
|
||||||
|
|
||||||
esp32_cs = DigitalInOut(board.GP10)
|
esp32_cs = DigitalInOut(board.GP10)
|
||||||
esp32_ready = DigitalInOut(board.GP9)
|
esp32_ready = DigitalInOut(board.GP9)
|
||||||
@@ -24,9 +24,9 @@ wifi = adafruit_esp32spi_wifimanager.ESPSPI_WiFiManager(esp, secrets)
|
|||||||
status_led.value = 1
|
status_led.value = 1
|
||||||
print("Connected. Making connection")
|
print("Connected. Making connection")
|
||||||
try:
|
try:
|
||||||
response = wifi.get("https://api.ipify.org")
|
response = wifi.get("https://api.ipify.org")
|
||||||
print(response.text)
|
print(response.text)
|
||||||
except:
|
except:
|
||||||
status_led.value = 0
|
status_led.value = 0
|
||||||
wifi.reset()
|
wifi.reset()
|
||||||
raise
|
raise
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ spi = busio.SPI(board.GP14, board.GP11, board.GP12)
|
|||||||
esp = adafruit_esp32spi.ESP_SPIcontrol(spi, esp32_cs, esp32_ready, esp32_reset)
|
esp = adafruit_esp32spi.ESP_SPIcontrol(spi, esp32_cs, esp32_ready, esp32_reset)
|
||||||
|
|
||||||
if esp.status == adafruit_esp32spi.WL_IDLE_STATUS:
|
if esp.status == adafruit_esp32spi.WL_IDLE_STATUS:
|
||||||
print("ESP32 found and in idle mode")
|
print("ESP32 found and in idle mode")
|
||||||
print("Firmware vers.", esp.firmware_version)
|
print("Firmware vers.", esp.firmware_version)
|
||||||
print("MAC addr:", [hex(i) for i in esp.MAC_address])
|
print("MAC addr:", [hex(i) for i in esp.MAC_address])
|
||||||
# esp.start_scan_networks()
|
# esp.start_scan_networks()
|
||||||
@@ -23,5 +23,5 @@ print("MAC addr:", [hex(i) for i in esp.MAC_address])
|
|||||||
# time.sleep(5)
|
# time.sleep(5)
|
||||||
|
|
||||||
for ap in esp.scan_networks():
|
for ap in esp.scan_networks():
|
||||||
print("\t%s\t\tRSSI: %d" % (str(ap['ssid'], 'utf-8'), ap['rssi']))
|
print("\t%s\t\tRSSI: %d" % (str(ap["ssid"], "utf-8"), ap["rssi"]))
|
||||||
print("Done!")
|
print("Done!")
|
||||||
|
|||||||
@@ -5,18 +5,17 @@ from adafruit_wsgi.wsgi_app import WSGIApp
|
|||||||
|
|
||||||
app = WSGIApp()
|
app = WSGIApp()
|
||||||
|
|
||||||
|
|
||||||
@app.route("/")
|
@app.route("/")
|
||||||
def index(request):
|
def index(request):
|
||||||
with open("hello.html") as fd:
|
with open("hello.html") as fd:
|
||||||
hello_html = fd.read()
|
hello_html = fd.read()
|
||||||
return 200, [('Content-Type',"text/html")], hello_html
|
return 200, [("Content-Type", "text/html")], hello_html
|
||||||
|
|
||||||
|
|
||||||
print("Setting up wifi.")
|
print("Setting up wifi.")
|
||||||
wifi, esp = robot_wifi.connect_to_wifi()
|
wifi, esp = robot_wifi.connect_to_wifi()
|
||||||
server = adafruit_esp32spi_wsgiserver.WSGIServer(
|
server = adafruit_esp32spi_wsgiserver.WSGIServer(80, application=app)
|
||||||
80,
|
|
||||||
application=app
|
|
||||||
)
|
|
||||||
adafruit_esp32spi_wsgiserver.set_interface(esp)
|
adafruit_esp32spi_wsgiserver.set_interface(esp)
|
||||||
|
|
||||||
print("Starting server")
|
print("Starting server")
|
||||||
|
|||||||
@@ -5,16 +5,15 @@ from adafruit_wsgi.wsgi_app import WSGIApp
|
|||||||
|
|
||||||
app = WSGIApp()
|
app = WSGIApp()
|
||||||
|
|
||||||
|
|
||||||
@app.route("/")
|
@app.route("/")
|
||||||
def index(request):
|
def index(request):
|
||||||
return 200, [], "Hello world!"
|
return 200, [], "Hello world!"
|
||||||
|
|
||||||
|
|
||||||
print("Setting up wifi.")
|
print("Setting up wifi.")
|
||||||
wifi, esp = robot_wifi.connect_to_wifi()
|
wifi, esp = robot_wifi.connect_to_wifi()
|
||||||
server = adafruit_esp32spi_wsgiserver.WSGIServer(
|
server = adafruit_esp32spi_wsgiserver.WSGIServer(80, application=app)
|
||||||
80,
|
|
||||||
application=app
|
|
||||||
)
|
|
||||||
adafruit_esp32spi_wsgiserver.set_interface(esp)
|
adafruit_esp32spi_wsgiserver.set_interface(esp)
|
||||||
|
|
||||||
print("Starting server")
|
print("Starting server")
|
||||||
|
|||||||
@@ -5,21 +5,21 @@ from adafruit_esp32spi import adafruit_esp32spi
|
|||||||
from adafruit_esp32spi import adafruit_esp32spi_wifimanager
|
from adafruit_esp32spi import adafruit_esp32spi_wifimanager
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from secrets import secrets
|
from secrets import secrets
|
||||||
except ImportError:
|
except ImportError:
|
||||||
print("WiFi secrets are kept in secrets.py, please add them there!")
|
print("WiFi secrets are kept in secrets.py, please add them there!")
|
||||||
raise
|
raise
|
||||||
|
|
||||||
|
|
||||||
def connect_to_wifi():
|
def connect_to_wifi():
|
||||||
esp32_cs = DigitalInOut(board.GP10)
|
esp32_cs = DigitalInOut(board.GP10)
|
||||||
esp32_ready = DigitalInOut(board.GP9)
|
esp32_ready = DigitalInOut(board.GP9)
|
||||||
esp32_reset = DigitalInOut(board.GP8)
|
esp32_reset = DigitalInOut(board.GP8)
|
||||||
|
|
||||||
spi = busio.SPI(board.GP14, MOSI=board.GP11, MISO=board.GP12)
|
spi = busio.SPI(board.GP14, MOSI=board.GP11, MISO=board.GP12)
|
||||||
esp = adafruit_esp32spi.ESP_SPIcontrol(spi, esp32_cs, esp32_ready, esp32_reset)
|
esp = adafruit_esp32spi.ESP_SPIcontrol(spi, esp32_cs, esp32_ready, esp32_reset)
|
||||||
esp.reset()
|
esp.reset()
|
||||||
wifi = adafruit_esp32spi_wifimanager.ESPSPI_WiFiManager(esp, secrets)
|
wifi = adafruit_esp32spi_wifimanager.ESPSPI_WiFiManager(esp, secrets)
|
||||||
wifi.connect()
|
wifi.connect()
|
||||||
|
|
||||||
return wifi, esp
|
return wifi, esp
|
||||||
|
|||||||
@@ -54,24 +54,24 @@ send:
|
|||||||
|
|
||||||
assembled = adafruit_pioasm.assemble(program)
|
assembled = adafruit_pioasm.assemble(program)
|
||||||
|
|
||||||
|
|
||||||
class QuadratureEncoder:
|
class QuadratureEncoder:
|
||||||
def __init__(self, first_pin, second_pin, reversed=False):
|
def __init__(self, first_pin, second_pin, reversed=False):
|
||||||
"""Encoder with 2 pins. Must use sequential pins on the board"""
|
"""Encoder with 2 pins. Must use sequential pins on the board"""
|
||||||
self.sm = rp2pio.StateMachine(
|
self.sm = rp2pio.StateMachine(
|
||||||
assembled,
|
assembled,
|
||||||
frequency=0,
|
frequency=0,
|
||||||
first_in_pin=first_pin,
|
first_in_pin=first_pin,
|
||||||
jmp_pin=second_pin,
|
jmp_pin=second_pin,
|
||||||
in_pin_count=2
|
in_pin_count=2,
|
||||||
)
|
)
|
||||||
self.reversed = reversed
|
self.reversed = reversed
|
||||||
self._buffer = array.array('i', [0])
|
self._buffer = array.array("i", [0])
|
||||||
|
|
||||||
def read(self):
|
|
||||||
while self.sm.in_waiting:
|
|
||||||
self.sm.readinto(self._buffer)
|
|
||||||
if self.reversed:
|
|
||||||
return -self._buffer[0]
|
|
||||||
else:
|
|
||||||
return self._buffer[0]
|
|
||||||
|
|
||||||
|
def read(self):
|
||||||
|
while self.sm.in_waiting:
|
||||||
|
self.sm.readinto(self._buffer)
|
||||||
|
if self.reversed:
|
||||||
|
return -self._buffer[0]
|
||||||
|
else:
|
||||||
|
return self._buffer[0]
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ def stop():
|
|||||||
motor_B1.duty_cycle = 0
|
motor_B1.duty_cycle = 0
|
||||||
motor_B2.duty_cycle = 0
|
motor_B2.duty_cycle = 0
|
||||||
|
|
||||||
|
|
||||||
def set_speed(motor, speed):
|
def set_speed(motor, speed):
|
||||||
# Swap motor pins if we reverse the speed
|
# Swap motor pins if we reverse the speed
|
||||||
if speed < 0:
|
if speed < 0:
|
||||||
@@ -36,15 +37,16 @@ def set_speed(motor, speed):
|
|||||||
speed = -speed
|
speed = -speed
|
||||||
else:
|
else:
|
||||||
direction = motor
|
direction = motor
|
||||||
speed = min(speed, 1) # limit to 1.0
|
speed = min(speed, 1) # limit to 1.0
|
||||||
max_speed = 2**16-1
|
max_speed = 2 ** 16 - 1
|
||||||
|
|
||||||
|
|
||||||
direction[0].duty_cycle = int(max_speed * speed)
|
direction[0].duty_cycle = int(max_speed * speed)
|
||||||
direction[1].duty_cycle = 0
|
direction[1].duty_cycle = 0
|
||||||
|
|
||||||
|
|
||||||
def set_left(speed):
|
def set_left(speed):
|
||||||
set_speed(left_motor, speed)
|
set_speed(left_motor, speed)
|
||||||
|
|
||||||
|
|
||||||
def set_right(speed):
|
def set_right(speed):
|
||||||
set_speed(right_motor, speed)
|
set_speed(right_motor, speed)
|
||||||
|
|||||||
@@ -5,21 +5,21 @@ from adafruit_esp32spi import adafruit_esp32spi
|
|||||||
from adafruit_esp32spi import adafruit_esp32spi_wifimanager
|
from adafruit_esp32spi import adafruit_esp32spi_wifimanager
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from secrets import secrets
|
from secrets import secrets
|
||||||
except ImportError:
|
except ImportError:
|
||||||
print("WiFi secrets are kept in secrets.py, please add them there!")
|
print("WiFi secrets are kept in secrets.py, please add them there!")
|
||||||
raise
|
raise
|
||||||
|
|
||||||
|
|
||||||
def connect_to_wifi():
|
def connect_to_wifi():
|
||||||
esp32_cs = DigitalInOut(board.GP10)
|
esp32_cs = DigitalInOut(board.GP10)
|
||||||
esp32_ready = DigitalInOut(board.GP9)
|
esp32_ready = DigitalInOut(board.GP9)
|
||||||
esp32_reset = DigitalInOut(board.GP8)
|
esp32_reset = DigitalInOut(board.GP8)
|
||||||
|
|
||||||
spi = busio.SPI(board.GP14, MOSI=board.GP11, MISO=board.GP12)
|
spi = busio.SPI(board.GP14, MOSI=board.GP11, MISO=board.GP12)
|
||||||
esp = adafruit_esp32spi.ESP_SPIcontrol(spi, esp32_cs, esp32_ready, esp32_reset)
|
esp = adafruit_esp32spi.ESP_SPIcontrol(spi, esp32_cs, esp32_ready, esp32_reset)
|
||||||
esp.reset()
|
esp.reset()
|
||||||
wifi = adafruit_esp32spi_wifimanager.ESPSPI_WiFiManager(esp, secrets)
|
wifi = adafruit_esp32spi_wifimanager.ESPSPI_WiFiManager(esp, secrets)
|
||||||
wifi.connect()
|
wifi.connect()
|
||||||
|
|
||||||
return wifi, esp
|
return wifi, esp
|
||||||
|
|||||||
@@ -8,27 +8,27 @@ import robot
|
|||||||
|
|
||||||
app = WSGIApp()
|
app = WSGIApp()
|
||||||
|
|
||||||
|
|
||||||
@app.route("/")
|
@app.route("/")
|
||||||
def index(request):
|
def index(request):
|
||||||
with open("sensor.html") as fd:
|
with open("sensor.html") as fd:
|
||||||
hello_html = fd.read()
|
hello_html = fd.read()
|
||||||
return 200, [('Content-Type',"text/html")], [hello_html]
|
return 200, [("Content-Type", "text/html")], [hello_html]
|
||||||
|
|
||||||
|
|
||||||
@app.route("/sensors")
|
@app.route("/sensors")
|
||||||
def sensors(request):
|
def sensors(request):
|
||||||
sensor_data = {
|
sensor_data = {
|
||||||
"left_distance": robot.left_distance.distance,
|
"left_distance": robot.left_distance.distance,
|
||||||
}
|
}
|
||||||
robot.left_distance.clear_interrupt()
|
robot.left_distance.clear_interrupt()
|
||||||
|
|
||||||
|
return 200, [("Content-Type", "application/json")], [json.dumps(sensor_data)]
|
||||||
|
|
||||||
return 200, [('Content-Type', 'application/json')], [json.dumps(sensor_data)]
|
|
||||||
|
|
||||||
print("Setting up wifi.")
|
print("Setting up wifi.")
|
||||||
wifi, esp = robot_wifi.connect_to_wifi()
|
wifi, esp = robot_wifi.connect_to_wifi()
|
||||||
server = adafruit_esp32spi_wsgiserver.WSGIServer(
|
server = adafruit_esp32spi_wsgiserver.WSGIServer(80, application=app)
|
||||||
80,
|
|
||||||
application=app
|
|
||||||
)
|
|
||||||
adafruit_esp32spi_wsgiserver.set_interface(esp)
|
adafruit_esp32spi_wsgiserver.set_interface(esp)
|
||||||
|
|
||||||
print("Initialising sensors")
|
print("Initialising sensors")
|
||||||
@@ -44,9 +44,9 @@ print(f"IP Address is {ip_int}")
|
|||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
try:
|
try:
|
||||||
server.update_poll()
|
server.update_poll()
|
||||||
except RuntimeError as e:
|
except RuntimeError as e:
|
||||||
print(f"Server poll error: {type(e)}, {e}")
|
print(f"Server poll error: {type(e)}, {e}")
|
||||||
# background task
|
# background task
|
||||||
except:
|
except:
|
||||||
print("Shutting down wifi on failure. resetting ESP")
|
print("Shutting down wifi on failure. resetting ESP")
|
||||||
|
|||||||
@@ -54,24 +54,24 @@ send:
|
|||||||
|
|
||||||
assembled = adafruit_pioasm.assemble(program)
|
assembled = adafruit_pioasm.assemble(program)
|
||||||
|
|
||||||
|
|
||||||
class QuadratureEncoder:
|
class QuadratureEncoder:
|
||||||
def __init__(self, first_pin, second_pin, reversed=False):
|
def __init__(self, first_pin, second_pin, reversed=False):
|
||||||
"""Encoder with 2 pins. Must use sequential pins on the board"""
|
"""Encoder with 2 pins. Must use sequential pins on the board"""
|
||||||
self.sm = rp2pio.StateMachine(
|
self.sm = rp2pio.StateMachine(
|
||||||
assembled,
|
assembled,
|
||||||
frequency=0,
|
frequency=0,
|
||||||
first_in_pin=first_pin,
|
first_in_pin=first_pin,
|
||||||
jmp_pin=second_pin,
|
jmp_pin=second_pin,
|
||||||
in_pin_count=2
|
in_pin_count=2,
|
||||||
)
|
)
|
||||||
self.reversed = reversed
|
self.reversed = reversed
|
||||||
self._buffer = array.array('i', [0])
|
self._buffer = array.array("i", [0])
|
||||||
|
|
||||||
def read(self):
|
|
||||||
while self.sm.in_waiting:
|
|
||||||
self.sm.readinto(self._buffer)
|
|
||||||
if self.reversed:
|
|
||||||
return -self._buffer[0]
|
|
||||||
else:
|
|
||||||
return self._buffer[0]
|
|
||||||
|
|
||||||
|
def read(self):
|
||||||
|
while self.sm.in_waiting:
|
||||||
|
self.sm.readinto(self._buffer)
|
||||||
|
if self.reversed:
|
||||||
|
return -self._buffer[0]
|
||||||
|
else:
|
||||||
|
return self._buffer[0]
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ def stop():
|
|||||||
motor_B1.duty_cycle = 0
|
motor_B1.duty_cycle = 0
|
||||||
motor_B2.duty_cycle = 0
|
motor_B2.duty_cycle = 0
|
||||||
|
|
||||||
|
|
||||||
def set_speed(motor, speed):
|
def set_speed(motor, speed):
|
||||||
# Swap motor pins if we reverse the speed
|
# Swap motor pins if we reverse the speed
|
||||||
if speed < 0:
|
if speed < 0:
|
||||||
@@ -36,15 +37,16 @@ def set_speed(motor, speed):
|
|||||||
speed = -speed
|
speed = -speed
|
||||||
else:
|
else:
|
||||||
direction = motor
|
direction = motor
|
||||||
speed = min(speed, 1) # limit to 1.0
|
speed = min(speed, 1) # limit to 1.0
|
||||||
max_speed = 2**16-1
|
max_speed = 2 ** 16 - 1
|
||||||
|
|
||||||
|
|
||||||
direction[0].duty_cycle = int(max_speed * speed)
|
direction[0].duty_cycle = int(max_speed * speed)
|
||||||
direction[1].duty_cycle = 0
|
direction[1].duty_cycle = 0
|
||||||
|
|
||||||
|
|
||||||
def set_left(speed):
|
def set_left(speed):
|
||||||
set_speed(left_motor, speed)
|
set_speed(left_motor, speed)
|
||||||
|
|
||||||
|
|
||||||
def set_right(speed):
|
def set_right(speed):
|
||||||
set_speed(right_motor, speed)
|
set_speed(right_motor, speed)
|
||||||
|
|||||||
+12
-12
@@ -5,21 +5,21 @@ from adafruit_esp32spi import adafruit_esp32spi
|
|||||||
from adafruit_esp32spi import adafruit_esp32spi_wifimanager
|
from adafruit_esp32spi import adafruit_esp32spi_wifimanager
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from secrets import secrets
|
from secrets import secrets
|
||||||
except ImportError:
|
except ImportError:
|
||||||
print("WiFi secrets are kept in secrets.py, please add them there!")
|
print("WiFi secrets are kept in secrets.py, please add them there!")
|
||||||
raise
|
raise
|
||||||
|
|
||||||
|
|
||||||
def connect_to_wifi():
|
def connect_to_wifi():
|
||||||
esp32_cs = DigitalInOut(board.GP10)
|
esp32_cs = DigitalInOut(board.GP10)
|
||||||
esp32_ready = DigitalInOut(board.GP9)
|
esp32_ready = DigitalInOut(board.GP9)
|
||||||
esp32_reset = DigitalInOut(board.GP8)
|
esp32_reset = DigitalInOut(board.GP8)
|
||||||
|
|
||||||
spi = busio.SPI(board.GP14, MOSI=board.GP11, MISO=board.GP12)
|
spi = busio.SPI(board.GP14, MOSI=board.GP11, MISO=board.GP12)
|
||||||
esp = adafruit_esp32spi.ESP_SPIcontrol(spi, esp32_cs, esp32_ready, esp32_reset)
|
esp = adafruit_esp32spi.ESP_SPIcontrol(spi, esp32_cs, esp32_ready, esp32_reset)
|
||||||
esp.reset()
|
esp.reset()
|
||||||
wifi = adafruit_esp32spi_wifimanager.ESPSPI_WiFiManager(esp, secrets)
|
wifi = adafruit_esp32spi_wifimanager.ESPSPI_WiFiManager(esp, secrets)
|
||||||
wifi.connect()
|
wifi.connect()
|
||||||
|
|
||||||
return wifi, esp
|
return wifi, esp
|
||||||
|
|||||||
+26
-24
@@ -11,26 +11,31 @@ import robot
|
|||||||
|
|
||||||
app = WSGIApp()
|
app = WSGIApp()
|
||||||
|
|
||||||
|
|
||||||
class State:
|
class State:
|
||||||
stop_at = 0
|
stop_at = 0
|
||||||
|
|
||||||
|
|
||||||
state = State()
|
state = State()
|
||||||
|
|
||||||
|
|
||||||
@app.route("/")
|
@app.route("/")
|
||||||
def index(request):
|
def index(request):
|
||||||
with open("teleop.html") as fd:
|
with open("teleop.html") as fd:
|
||||||
hello_html = fd.read()
|
hello_html = fd.read()
|
||||||
return 200, [('Content-Type',"text/html")], [hello_html]
|
return 200, [("Content-Type", "text/html")], [hello_html]
|
||||||
|
|
||||||
|
|
||||||
@app.route("/control", methods=["POST"])
|
@app.route("/control", methods=["POST"])
|
||||||
def control(request):
|
def control(request):
|
||||||
movement = json.load(request.body)
|
movement = json.load(request.body)
|
||||||
print(f"Received movement: {movement}")
|
print(f"Received movement: {movement}")
|
||||||
|
|
||||||
|
robot.set_left(-movement[1] + movement[0])
|
||||||
|
robot.set_right(-movement[1] - movement[0])
|
||||||
|
state.stop_at = time.time() + 1
|
||||||
|
return 200, [("Content-Type", "application/json")], ["true"]
|
||||||
|
|
||||||
robot.set_left(-movement[1] + movement[0])
|
|
||||||
robot.set_right(-movement[1] - movement[0])
|
|
||||||
state.stop_at = time.time() + 1
|
|
||||||
return 200, [('Content-Type',"application/json")], ["true"]
|
|
||||||
|
|
||||||
print("Setting up wifi.")
|
print("Setting up wifi.")
|
||||||
status_led = DigitalInOut(board.LED)
|
status_led = DigitalInOut(board.LED)
|
||||||
@@ -39,10 +44,7 @@ status_led.value = False
|
|||||||
|
|
||||||
|
|
||||||
wifi, esp = robot_wifi.connect_to_wifi()
|
wifi, esp = robot_wifi.connect_to_wifi()
|
||||||
server = adafruit_esp32spi_wsgiserver.WSGIServer(
|
server = adafruit_esp32spi_wsgiserver.WSGIServer(80, application=app)
|
||||||
80,
|
|
||||||
application=app
|
|
||||||
)
|
|
||||||
adafruit_esp32spi_wsgiserver.set_interface(esp)
|
adafruit_esp32spi_wsgiserver.set_interface(esp)
|
||||||
|
|
||||||
print("Starting server")
|
print("Starting server")
|
||||||
@@ -60,18 +62,18 @@ while True:
|
|||||||
status_led.value = True
|
status_led.value = True
|
||||||
# background task
|
# background task
|
||||||
if state.stop_at < time.time():
|
if state.stop_at < time.time():
|
||||||
robot.stop()
|
robot.stop()
|
||||||
except RuntimeError as e:
|
except RuntimeError as e:
|
||||||
print(f"Server poll error: {type(e)}, {e}")
|
print(f"Server poll error: {type(e)}, {e}")
|
||||||
robot.stop()
|
robot.stop()
|
||||||
print(f"Resetting ESP...")
|
print(f"Resetting ESP...")
|
||||||
wifi.reset()
|
wifi.reset()
|
||||||
print("Reset complete.")
|
print("Reset complete.")
|
||||||
except:
|
except:
|
||||||
print("Shutting down wifi on failure. resetting ESP")
|
print("Shutting down wifi on failure. resetting ESP")
|
||||||
robot.stop()
|
robot.stop()
|
||||||
wifi.reset()
|
wifi.reset()
|
||||||
raise
|
raise
|
||||||
|
|
||||||
# Reader exercise
|
# Reader exercise
|
||||||
# Can you combine the sensors and the control app? Can you think about how to control it using the sensors for feedback.
|
# Can you combine the sensors and the control app? Can you think about how to control it using the sensors for feedback.
|
||||||
|
|||||||
Reference in New Issue
Block a user