Using REST with Arduino Yun

Progress on the rgb leds continues, here is the code for a useful android testing tool, with a very brutal looking UI.. awful. sliders for the red, green, blue light levels, few buttons for presets and scrolling debug messaging. the only noteworthy thing is defining the range of the sliders to suit the pwm levels on the arduino end.. so, [0 – 255] values for each colour. I was trying to adjust these max values to actually set the max levels of light to get the brightest, whitest whites. the blue led is very much brighter so simply maxing them out doesn’t give you a proper white colour using the dealextreme ones I found. the circuit for these led’s, some code hints that got me started and be found on the server box blog.

Simply load the bridge REST example code into the yun.

Getting updates on a timer is easy, just remember the create a new thread for everything. using the REST url for retrieving all the arduino’s pin states and variables is best done all at once and then doing a quick parse. just chop out the matching values for each pin on the arduino.

I have put the android project files on my server if anyone cares to expand on this project. There is exactly zero effort put into the gui at this point, because I’m awful at user interfaces and ultimately this will all be run as scripts by the home automation server anyway. the rest of this system includes a jetty server, servlets, batteries and wifi controlled robots. nerdy goodness..

To test from my laptop I often use the curl command instead of a web browser, it’s just faster to scroll through the command history using the terminal.