Pico fixes

This commit is contained in:
2026-04-02 21:48:31 +02:00
parent 0333b12fb3
commit 13c0fd32d6
3 changed files with 17 additions and 4 deletions

View File

@@ -7,6 +7,7 @@ import ssl
# global variable for the IP-Adress of the laptop hotspot
IP_ADRESS_SERVER:str = '192.168.0.100' #None
#IP_ADRESS_SERVER:str = '10.232.67.121' #None
IP_ADRESS_ACCESSPOINT = None
SERVER_PORT:int = 3000 #None
@@ -29,7 +30,7 @@ def wifi_connect(SSID:str, PASSWORD:str) -> None:
print("Connected to", SSID)
# geat and print IP-adress of raspberry
ip_adress_pico = wifi.ifconfig()[0]
print("IP-Adresse Pico:", ip_adress_pico)
print("IP-Adress Pico:", ip_adress_pico)
# get ip-adress of access point and store it in the global variable
global IP_ADRESS_ACCESSPOINT
IP_ADRESS_ACCESSPOINT = wifi.ifconfig()[2]
@@ -42,12 +43,12 @@ def wifi_connect(SSID:str, PASSWORD:str) -> None:
def send_request(user_id:int, rating:int) -> bool:
# create HTTP-URL
URL = f"http://{IP_ADRESS_SERVER}:{str(SERVER_PORT)}/ratings/{user_id}/{rating}"
URL = f"http://{IP_ADRESS_SERVER}:{str(SERVER_PORT)}/{user_id}/{rating}"
print(URL)
try:
# create request
response = urequests.get(URL)
response = urequests.get(URL, timeout=5.0)
# print HTTP-answer of the access point
print("Server response:")