Created
May 30, 2014 21:49
-
-
Save schappim/dea6f81f2115d2766580 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // the setup routine runs once when you press reset: | |
| void setup() { | |
| // initialize serial communication at 9600 bits per second: | |
| Serial.begin(9600); | |
| } | |
| // the loop routine runs over and over again forever: | |
| void loop() { | |
| // read the input on analog pin 0: | |
| int sensorValue = analogRead(A0); | |
| // Convert the analog reading (which goes from 0 - 1023) to a voltage (0 - 5V): | |
| int red = analogRead(A0); | |
| int green = analogRead(A1); | |
| int blue = analogRead(A2); | |
| // print out the value you read: | |
| Serial.print(red); | |
| Serial.print(','); | |
| Serial.print(green); | |
| Serial.print(','); | |
| Serial.println(blue); | |
| analogWrite(11, map(red,0,1000,0,253)); | |
| analogWrite(10, map(green,0,1000,0,253)); | |
| analogWrite(9, map(blue,0,1000,0,253)); | |
| delay(10); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment