/*
  Arduino Starter Kit example
  Project 4 - Color Mixing Lamp

  This sketch is written to accompany Project 3 in the Arduino Starter Kit

  Parts required:
  - one RGB LED
  - three 10 kilohm resistors
  - three 220 ohm resistors
  - three photoresistors
  - red green and blue colored gels

  created 13 Sep 2012
  modified 14 Nov 2012
  by Scott Fitzgerald
  Thanks to Federico Vanzati for improvements

  https://store.arduino.cc/genuino-starter-kit

  This example code is part of the public domain.
*/
const int redLEDPin = 10;     // LED connected to digital pin 10
const int redSensorPin = A2;  // pin with the photoresistor with the red gel
int redValue = 0; // value to write to the red LED
int redSensorValue =1000; // variable to hold the value from the red sensor
void setup() {
  // initialize serial communications at 9600 bps:
  Serial.begin(9600);
  // set the digital pins as outputs
  pinMode(redLEDPin, OUTPUT);
}

void loop() {
 
  redSensorValue = analogRead(redSensorPin);
  // give the ADC a moment to settle
  delay(5);
  // print out the values to the Serial Monitor
  Serial.print("raw sensor Values \t red: ");
  Serial.print(redSensorValue);
  redValue = 255 - redSensorValue / 4;
  Serial.print("LED \t red: ");
  Serial.print(redValue);
  analogWrite(redLEDPin, redValue);
 
}