Day 4:

[embedpress]https://docs.google.com/presentation/d/e/2PACX-1vRoHqOanm86Lo4LCDe4xdvIDswh4R6oHd_b_4q93fEPlBP1DpmZNV9wXINEwr7S80dpxyvm8LM2hcC3/pub?start=false&loop=false&delayms=60000[/embedpress]

SLIDE:

https://docs.google.com/presentation/d/e/2PACX-1vRoHqOanm86Lo4LCDe4xdvIDswh4R6oHd_b_4q93fEPlBP1DpmZNV9wXINEwr7S80dpxyvm8LM2hcC3/pub?start=false&loop=false&delayms=60000

PIR Motion Sensor:

int ledPin = 13;                // LED 
int pirPin = 2;                 // PIR Out pin 
int pirStat = 0;                // PIR status
void setup() {
 pinMode(ledPin, OUTPUT);     
 pinMode(pirPin, INPUT);     
 Serial.begin(9600);
}
void loop(){
 pirStat = digitalRead(pirPin); 
 if (pirStat == HIGH) {            // if motion detected
   digitalWrite(ledPin, HIGH);  // turn LED ON
   Serial.println("Hey I got you!!!");
 } 
 else {
   digitalWrite(ledPin, LOW); // turn LED OFF if we have no motion
 }
}

LCD Display Keypad Shield Code:

#include <Wire.h>
#include <LiquidCrystal.h>

LiquidCrystal lcd( 8,9,4,5,6,7 );  //interfacing pins

void setup()
{

   // set up the LCD's number of columns and rows:
  lcd.begin(16, 2);
  // Print a message to the LCD.
  lcd.setCursor(0,0);
  lcd.print("LCD Key Shield");
  lcd.setCursor(0,1);
  lcd.print("Press Key:");
}

void loop()
{
  int x;
  x = analogRead (0);
  lcd.setCursor(10,1);
  if (x < 60) {
    lcd.print ("Right ");
  }
  else if (x < 200) {
    lcd.print ("Up    ");    //analog voltage 145
  }
  else if (x < 400){
    lcd.print ("Down  ");    //analog voltage 329
  }
  else if (x < 600){
    lcd.print ("Left  ");    //analog voltage 585
  }
  else if (x < 800){
    lcd.print ("Select");    //analog voltage 741
  }
}