Changes

Jump to: navigation, search

Week 4 Lab

245 bytes added, 15:32, 21 April 2009
The other way around: Driving a Computer Program with Data from the Arduino
*Change the <code>Integer.parseInt(buff);</code> statements to say <code>rval = Integer.parseInt(buff)/4;</code>. This relates to the issue last week with the <code>analogRead()</code> and <code>analogWrite()</code>: our Arduino is transmitting a 10bit (0-1023) value captured from the <code>analogRead()</code>, but the <code>background(rval, gval, bval);</code> command in Processing wants 8bit (0-255) values for Red, Green, and Blue. Thus, we need to divide the 10 bit values by 4.
[[Image:Arduino_color_mixer.png|300px]]
* Run this program (same as on the Arduino, click the little "Play" button at the upper left). A new window should appear like the one below:
[[Image:Color_mix.png]]
* You should be able to change the color of the on-screen square by dialing the knobs back and forth.
== Pachube ==

Navigation menu