graycatlabs / PyBBIO

A Python library for Arduino-style hardware IO support on the Beaglebone
https://github.com/graycatlabs/PyBBIO/wiki
MIT License
251 stars 87 forks source link

Added range slider to BBIOServer! #51

Closed Ikario closed 10 years ago

Ikario commented 10 years ago

So I'm not an expert on Python, HTML or BBB but while using pyBBIO library I thought that a slider might be neat, so I checked the BBIO_server source and specially the add_entry function and thought it could not be that hard. Thus, I add add_range. It works just like add_entry, but it takes some extra optional values as well that are pretty much self explanatory:

minvalue is the minimum value of the slider (all the way to the left) maxvalue is the maximum value of the slider (all the way to the right) defaultvalue is the default value where the slider starts when you load the page stepsize is the size of the steps in the slider, so the amount of steps you have ends up being (maxvalue-minvalue)/stepsize

It works with integers as well as floats and returns, as add_entry a string that can be easily manipulated. Tested and working properly on Firefox, Chrome and Safari, all of those in Mac OS X 10.9.4.

Hope this is helpful for someone other than me :)

Resubmitting it as I probably submitted it wrong the last time.

alexanderhiam commented 10 years ago

And merged. Thanks!