const int greenLEDPin = 9;    // LED connected to digital pin 9 
const int redLEDPin = 10;     // LED connected to digital pin 10 
const int blueLEDPin = 11;    // LED connected to digital pin 11 
const int redSensorPin = A0;  // pin with the photoresistor with the red gel 
const int greenSensorPin = A1;   // pin with the photoresistor with the green gel 
const int blueSensorPin = A2;   // pin with the photoresistor with the blue gel 
int redValue = 0; // value to write to the red LED 
int greenValue = 0; // value to write to the green LED 
int blueValue = 0; // value to write to the blue LED 
int redSensorValue = 0; // variable to hold the value from the red sensor 
int greenSensorValue = 0; // variable to hold the value from the green sensor 
int blueSensorValue = 0; // variable to hold the value from the blue sensor 
void setup() { 
  // initialize serial communications at 9600 bps: 
  Serial.begin(9600); 
  // set the digital pins as outputs 
  pinMode(greenLEDPin, OUTPUT); 
  pinMode(redLEDPin, OUTPUT); 
  pinMode(blueLEDPin, OUTPUT); 
} 
void loop() { 
  // Read the sensors first: 
  // read the value from the red-filtered photoresistor: 
  redSensorValue = analogRead(redSensorPin); 
  // give the ADC a moment to settle 
  delay(250); 
  // read the value from the green-filtered photoresistor: 
  greenSensorValue = analogRead(greenSensorPin); 
  // give the ADC a moment to settle:
  delay(500);
  // read the value from the blue-filtered photoresistor: 
  blueSensorValue = analogRead(blueSensorPin); 
  // print out the values to the Serial Monitor 
  Serial.print("raw sensor Values \t red: "); 
  Serial.print(redSensorValue); 
  Serial.print("\t green: ");
  Serial.print(greenSensorValue); 
  Serial.print("\t Blue: "); 
  Serial.println(blueSensorValue); 
  /* 
    In order to use the values from the sensor for the LED, you need to do some 
    math. The ADC provides a 10-bit number, but analogWrite() uses 8 bits. 
    You'll want to divide your sensor readings by 4 to keep them in range 
    of the output. 
  */ 
  redValue = 255 - redSensorValue / 4; 
  greenValue = 255 - greenSensorValue / 4; 
  blueValue = 255 - blueSensorValue / 4; 
  // print out the mapped values 
  Serial.print("Mapped sensor Values \t red: "); 
  Serial.print(redValue); 
  Serial.print("\t green: ");
  Serial.print(greenValue); 
  Serial.print("\t Blue: ");
  Serial.println(blueValue); 
  /* 
    Now that you have a usable value, it's time to PWM the LED. 
  */ 
  analogWrite(redLEDPin, redValue); 
  analogWrite(greenLEDPin, greenValue); 
  analogWrite(blueLEDPin, blueValue); 
} 
uno:A5.2
uno:A4.2
uno:AREF
uno:GND.1
uno:13
uno:12
uno:11
uno:10
uno:9
uno:8
uno:7
uno:6
uno:5
uno:4
uno:3
uno:2
uno:1
uno:0
uno:IOREF
uno:RESET
uno:3.3V
uno:5V
uno:GND.2
uno:GND.3
uno:VIN
uno:A0
uno:A1
uno:A2
uno:A3
uno:A4
uno:A5
ldr1:VCC
ldr1:GND
ldr1:DO
ldr1:AO
ldr2:VCC
ldr2:GND
ldr2:DO
ldr2:AO
ldr3:VCC
ldr3:GND
ldr3:DO
ldr3:AO
r1:1
r1:2
r2:1
r2:2
r3:1
r3:2
rgb1:R
rgb1:COM
rgb1:G
rgb1:B