Played with this today - based on https://github.com/micropython/micropyt ... -server.py
https://github.com/cswiger/wipy/blob/ma ... -server.py
playing with http-client.py seems more useful for sending data outside actually.
HOWTO: simple webserver, very simple
Re: HOWTO: easy http client for publishing rest api data
This seems more useful - now to get the temp sensor (ds18b20) working!
https://github.com/cswiger/wipy/blob/ma ... -client.py
https://github.com/cswiger/wipy/blob/ma ... -client.py
Re: HOWTO: simple webserver, very simple
Have you tried this on actual CC3200 architecture or just unix version?
There seems to be an error with this line:
any help appreciated.
There seems to be an error with this line:
any help appreciated.
Code: Select all
>>> s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: no such attribute
>>> s.set
setsockopt settimeout setblocking
>>> s.setsockopt(socket.SOCK_
SOCK_STREAM SOCK_DGRAM SOCK_RAW
>>> s.setsockopt(socket.
__name__ socket getaddrinfo error
timeout AF_INET AF_INET6 SOCK_STREAM
SOCK_DGRAM SOCK_RAW IPPROTO_SEC IPPROTO_TCP
IPPROTO_UDP IPPROTO_RAW
Re: HOWTO: simple webserver, very simple
As far as I can tell, setsockopt() is not completely implemented yet. But for your first experiments, you don't need this function. So, just leave it out.
His second reference https://github.com/cswiger/wipy/blob/ma ... -server.py don't use this function either.
His second reference https://github.com/cswiger/wipy/blob/ma ... -server.py don't use this function either.
Re: HOWTO: simple webserver, very simple
I wrote a simple webserver with some Ajax functionality.
When accessing with a (modern) browser the server will send an html file to the browser, resulting in the next screen:
https://github.com/RinusW/WiPy/blob/mas ... ebpage.jpg
The 2 input elements communicate their value using Ajax to the server, the server responds with sending the value back to the browser and is used in the browser to update the value of the other input element.
So, adjusting the slider will result in a change of the value above the slider. And changing the number value will result in a new position of the slider. And this coupling is through the web server.
You find the python code and the html page with embedded javascript here:
https://github.com/RinusW/WiPy/tree/master/AiCWebserver
Btw: the webserver uses an endless loop and blocking calls. You can terminate the server by typing CTRL-C
When accessing with a (modern) browser the server will send an html file to the browser, resulting in the next screen:
https://github.com/RinusW/WiPy/blob/mas ... ebpage.jpg
The 2 input elements communicate their value using Ajax to the server, the server responds with sending the value back to the browser and is used in the browser to update the value of the other input element.
So, adjusting the slider will result in a change of the value above the slider. And changing the number value will result in a new position of the slider. And this coupling is through the web server.
You find the python code and the html page with embedded javascript here:
https://github.com/RinusW/WiPy/tree/master/AiCWebserver
Btw: the webserver uses an endless loop and blocking calls. You can terminate the server by typing CTRL-C
- danicampora
- Posts: 342
- Joined: Tue Sep 30, 2014 7:20 am
- Contact: