Herunterladen Diese Seite drucken

Arduino Alvik Bedienungsanleitung Seite 50

Werbung

user-manual-de.md
# Ignore favicon requests
if
path == '/favicon.ico':
conn.send('HTTP/1.1 204 No
conn.send('Connection:
return
# Control the robot based on the request path
if
path == '/up':
alvik.set_wheels_speed(30, 30)
elif
path == '/down':
alvik.set_wheels_speed(-30, -30)
elif
path == '/left':
alvik.set_wheels_speed(-30, 30)
elif
path == '/right':
alvik.set_wheels_speed(30, -30)
else:
alvik.brake()
# Send the response for valid paths
conn.send('HTTP/1.1 200
conn.send('Content-Type:
conn.send('Connection:
conn.sendall(html)
except
OSError
if
e.errno == 104:
print("Connection reset by
else:
print(f"Error:
finally:
conn.close()
# Main loop to handle incoming connections
try:
while
True:
try:
conn, addr = s.accept()
print('Connection
handle_request(conn)
except
if
elif
else:
except
KeyboardInterrupt:
print("Server
s.close()
alvik.stop()
OK\n')
text/html\n')
close\n\n')
as
e:
# ECONNRESET error
{e}")
from', addr)
OSError
as
e:
e.errno == 116:
# ETIMEDOUT error
print("Waiting for
e.errno == 104:
print("Connection reset by
print(f"Accept error:
stopped")
Content\n')
close\n\n')
client.")
connection...")
# ECONNRESET error
client.")
{e}")
50 / 70
2024-11-14

Werbung

loading

Diese Anleitung auch für:

Akx00066