[ALUG] Controlling a Raspberry PI I/O pins via web App
simon at nosher.net
Thu Oct 12 10:04:07 BST 2017
It's pretty trivial to set up a web server in Python directly, so you
could knock up a very simple server which both serves your web page and
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
""" A simple Python web server """
"""Handle HTTP Get requests"""
urlpath = urlparse.urlparse(self.path)
url = urlpath.path
if url eq "/myledwebpage.html"
elsif url eq "/myajaxhandler":
# get your LED state from URL params
self.send_response(403) # forbidden
self.wfile.write("Forbidden from " + path)
if __name__ == "__main__":
print('Starting HTTP server on port 8080")
server = HTTPServer(("", 8080), Handler)
On 11/10/17 18:28, steve-ALUG at hst.me.uk wrote:
> Can any Raspberry Pi users out there or web people help? I Want to use
> webpage to control Neopixels plugged into a Raspberry Pi. The webpage
> will have slider controls for R, G, B & overall brightness. I was
> initially thinking of using cgi-bin scripts using python, but I want the
> colour to change as the slider moves so I don't know if that would be
> responsive enough.
> Reading around, there seem to be many python-based solutions* so I could
> use cgi scripts, web sockets, webpy, flask, danjo or others. Anyone got
> a recommendation of which way to go. Lightweight and no security will do.
> *I want to use python if possible as that's what I'm most familiar with
> Any advice appreciated.
> main at lists.alug.org.uk
> Unsubscribe? See message headers or the web site above!
More information about the main