Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <LiquidCrystal.h>
- LiquidCrystal MiPantallita (2,3,4,5,6,7);
- #include <Servo.h>
- Servo miServito;
- #include <IRremote.h>
- const int pinServo =9;
- int RedLed = 10;
- int GreenLed = 11;
- const int RECV_PIN = 12;
- int buttonPin=13;
- int readValue;
- IRrecv irrecv(RECV_PIN);
- decode_results results;
- void setup(){
- Serial.begin(9600);
- miServito.attach(pinServo);
- irrecv.enableIRIn();
- irrecv.blink13(true);
- pinMode(GreenLed, OUTPUT);
- pinMode (RedLed, OUTPUT);
- digitalWrite(GreenLed, 1);
- digitalWrite(RedLed, 1);
- delay(10);
- MiPantallita.begin (16,2);
- MiPantallita.setCursor (2,0);
- MiPantallita.print ("lie detector");
- }
- void loop(){
- if (irrecv.decode(&results)){
- Serial.println(results.value, DEC);
- irrecv.resume();
- }
- if (results.value == 16724175)
- {
- Serial.println(" I am in 1");
- digitalWrite (GreenLed, HIGH);
- digitalWrite (RedLed, LOW);
- //servo move to green area
- MiPantallita.begin (16,2);
- MiPantallita.setCursor (4,0);
- MiPantallita.print ("truth");
- miServito.write (150);
- }
- if (results.value ==16718055)
- {
- Serial.println(" I am in 2");
- digitalWrite (GreenLed, LOW);
- digitalWrite (RedLed, HIGH);
- // servo move to lier section
- MiPantallita.begin (16,2);
- MiPantallita.setCursor (4,0);
- MiPantallita.print ("lie");
- miServito.write (30);
- }
- if (results.value == 16743045)
- {
- Serial.println(" I am in 3");
- digitalWrite (GreenLed, LOW);
- digitalWrite (RedLed, LOW);
- MiPantallita.begin (16,2);
- MiPantallita.setCursor (2,0);
- MiPantallita.print ("lie detector");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement