Run explorer hat code from a web browser


#1

I am looking for some sample code run to an explorer hat pro from a web browser.

Within the GUI python3.4, I have been able to run a script containing
import explorerhat
explorerhat.light.yellow.on()
and have it turn the yellow led on. I have not figured out how to do this from a browser. I suspect it is a permission issue, but don’t know much about the explorerhat software and how to make it run with the Apache user www-data.

.


Technical Support
#2

You’ll probably need to learn about Flask, which is in itself a web-server that would avoid the need for Apache, try this guide and substitute Explorer HAT code for the RPi.GPIO used: http://mattrichardson.com/Raspberry-Pi-Flask/


#3

Than you for taking the time to give me your input. I am ultimately interest in using the analog inputs of the explorer hat pro to measure DC voltage and temperature remotely thru through a browser interface. My use of the led lights example was to attempt to create a simple test case of using scripts to execute the explorer hat code via a browser. With my limited knowledge, it sounds like using the RPI PGIP instead of the explorer hat code, would prevent the use to the analog input features of the explore hat…


#4

I think I misunderstood your reply. I will take a closer look at the RPi GPIO Flask example you provided and see if the explorer hat code will work with it… Thanks.


#5

That’s fine, sorry I couldn’t provide a more concise example but I’m buried neck-deep in the shifting sands of Flotilla at the moment :D

Keep us posted!