Not getting Sensor Readings in Pysense with FiPy Module
-
@jcaron
Can you please send us the code to read current time stamp with fipy board -
-
@livius
Thank you for this help now we are getting a proper output. -
We are trying to connect to the station and access media using the procedure given the documentation. We are unable to connect to the accurate station and access point to specified IP address and ssid.
Could you please help to this problemThank You
-
@archana-kadam
Do you mean Wifi?
How your trying looks like? Any sample code. And if this is Wifi - what are your security settings on your router -WPA2or something different? -
@livius
Yes, We are trying to connect WiFi and our router is setup at WPA2 configuration.We tried with sample code provided in the pycom documentation.
We want fipy board to be worked as both station and access pointThank You
-
@archana-kadam
Did you fallowed both samples?
https://docs.pycom.io/chapter/tutorials/all/wlan.html
https://docs.pycom.io/chapter/firmwareapi/pycom/network/wlan.htmlbetter show the code and then we can help more -of course without passwords ;-)
-
@livius
https://docs.pycom.io/chapter/firmwareapi/pycom/network/wlan.html
we tried with this sample examples. -
- what you get when you do
nets = wlan.scan() print(nets)- is there your net ssid? and is there info about WPA2?
- do you use static IP?
this line is for static ip settings - but you must change it to follow your router settings
wlan.ifconfig(config=('192.168.0.107', '255.255.255.0', '192.168.0.1', '192.168.0.1')) -
@livius
By using
nets = wlan.scan()
print(nets)
we are getting details of connected WiFI.
Yes we have our net ssid and is configured to WPA2. Yes we were using this wlan.ifconfig(config=('192.168.0.107', '255.255.255.0', '192.168.0.1', '192.168.0.1'))
to configuration. How we can know that our WIFI is connected or disconnected -
@archana-kadam
you havewlan.isconnected()for that look here:
https://docs.pycom.io/chapter/tutorials/all/wlan.html#connecting-to-a-routerand are you sure that your router have same ip settings?
192.168.0.1? -
from network import WLAN wlan = WLAN(mode=WLAN.STA) nets = wlan.scan() for net in nets: if net.ssid == 'mywifi': print('Network found!') wlan.connect(net.ssid, auth=(net.sec, 'mywifikey'), timeout=5000) while not wlan.isconnected(): machine.idle() # save power while waiting print('WLAN connection succeeded!') breakUsing above code we are getting the details of connected wifi. And we have different ip address.
Here is the screenshot of our output please go through the image and update.
Thank You -
@archana-kadam
than you are connected to wifi - what more do you need? -
@livius
How we can know that is connected to Wifi?
How we can connect to both station as well as access point? -
@livius
Please explain the procedure of connecting fipy to server and how to send data of fipy to server -
@archana-kadam said in Not getting Sensor Readings in Pysense with FiPy Module:
How we can know that is connected to Wifi?
wlan.isconnected()
but to be really sure - only sending by socket tell this for sureHow we can connect to both station as well as access point?
change mode from
WLAN.STAinWLAN.STA_APPlease explain the procedure of connecting fipy to server and how to send data of fipy to server
simply create socket and send data throught it
e.g. from memory not tested but something like this should work
import socket s = socket.socket() s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect(socket.getaddrinfo('your server ip', your_server_port)[0][-1]) s.send(your_data) -
@livius
Can we send data through pybytes ?
Is a pybytes a server or its just a middleware to send data? -
@livius
From this above code we are getting an error called OSERORR :-01
import socket
s = socket.socket()
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(socket.getaddrinfo('192.168.0.109', 80)[0][-1])
your_data = "Hello"
s.send("your_data") -
From this above code we are getting an error called OSERORR :-01
At which line of code?
-
@livius
Line number 6 and 7
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login