RP2040 as network guard
Posted: Thu May 12, 2022 6:18 pm
hello,
first of all, i am a complete noob on the RP2040, python and micro python.
I want to use the arduina RP2040connect as a network guard.
it should check if a PC is online and then start the serverpc.
for that i need to ping the pc(s) and see if they are online.
I got this so far, but i get a error module object has no attribute system
what am i doing wrong?
grtz henk
import network, os
SSID='***' # Network SSID
KEY='********' # Network key
# Init wlan module and connect to network
print("Trying to connect... (may take a while)...")
wlan = network.WLAN(network.STA_IF)
wlan.active(True)
wlan.connect(SSID, key=KEY, security=wlan.WPA_PSK)
print(wlan.ifconfig())
hostname = "192.***.***.**"
response = os.system("ping -c 1 " + hostname)
if response == 0:
pingstatus = "Network Active"
else:
pingstatus = "Network Error"
module object has no attribute system
first of all, i am a complete noob on the RP2040, python and micro python.
I want to use the arduina RP2040connect as a network guard.
it should check if a PC is online and then start the serverpc.
for that i need to ping the pc(s) and see if they are online.
I got this so far, but i get a error module object has no attribute system
what am i doing wrong?
grtz henk
import network, os
SSID='***' # Network SSID
KEY='********' # Network key
# Init wlan module and connect to network
print("Trying to connect... (may take a while)...")
wlan = network.WLAN(network.STA_IF)
wlan.active(True)
wlan.connect(SSID, key=KEY, security=wlan.WPA_PSK)
print(wlan.ifconfig())
hostname = "192.***.***.**"
response = os.system("ping -c 1 " + hostname)
if response == 0:
pingstatus = "Network Active"
else:
pingstatus = "Network Error"
module object has no attribute system