Class 02- Lab assignments 02 03 04 05

Lab assignment 02:   Use a switch to flicker between LED’S.

Reading from a digital input find out if a button has been pressed and send messages to LED’s to flick between them. 
Key terms:
switchState= digitalRead(2);


Lab assignment 03:   Use a temperature sensor to light up LED’S.
Read from a sensor and calibrate its reading to meaningful data (C) and display onto the serial monitor. Use the temperature to switch on the value of a series of LED’s.
Key terms:
voltage = (sensorVal/1023.0) * 5.0;
temperature = (voltage -.5) * 100; 
if(temperature > baselineTemp+6 )


Lab assignment 04:   Use photoresistors to  light up a cathode RGB LED.
Read data from 3 photoresistors each with their own gels (r,g,b) 0-1023 convert the data
to 0-255 for the led values using PWM.Pulse Width Modulation. A call to is on a scale of 0 – 255, such that analogWrite(255) requests a 100% duty cycle (always on), and analogWrite(127) is a 50% duty cycle (on half the time) for example.
Key terms:
analogWrite(redLEDPin,redValue); (0-255)


Lab assignment 05:   Use a potentiometer to control a servomotor
Use an include library (servo) and add a servo class object to read the values from a potentiometer to a servo motor (0-180Deg). Remap potentiometer values (0-1023) to a servo motor values (0-180)
Key terms:
#include <Servo.h>
Servo myservo;
 angle = map(potVal,0,1023,0,179);