- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
After /thread/98922?sr=stream blinking an LED the next thing an IoT newb wants to do is control an LED from the web. I wanted to share what I did in the event someone else wants to do this. The app runs on SSL and requires auth to control the LED. To install I stopped the lighttpd server first.
systemctl stop lighttpd
systemctl disable lighttpd
Then install flask and pyopenssl
pip install flask
pip install pyopenssl
Download or clone the files here: https://github.com/joemcmanus/GalileoPyServer GitHub - joemcmanus/GalileoPyServer: A sample web server using Flask that can read digital & analog sensors as well as c…
Change the line
pin = mraa.Gpio(12)
Top match your pin for your LED. If you have a TMP36 temp sensor wire it up to A1.
Start the server.
There is a default SSL cert included so go to https://yourGalileoIP/ https://yourGalileoIP
Username is admin and password is galileo .
Sample wiring if you don't want to change any code.
Thanks for looking.
Cheers,
-Joe
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Thanks Joe this is great.
Could this also be used to execute python script on the server?
Cheers
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Absolutely. Since Flask is python you would just move your python script in to the server.py script.
i.e.
from flask import Flask
@app.route('/')
def index():
return(" /runScript Run my Script ")
@app.route('/runScript')
def runScript():
# Put all of your regular python code here.
# i.e. cut and paste your python script in to this section.
return("Ran Script")
if __name__ == '__main__':
app.run(host='0.0.0.0', port=80)
When you click on the link runScript it would execute your code. When it is done the text "Ran Script" would be returned to the screen. Flask is kind of amazing!
-Joe
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Hey joe,
Where do I place the files at?
Nevermind I got it. I put everything in as is using git clone ...
Thanks

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page