Advertisement
layavenkat

FINAL PROJECT ENGINEERING 2020

Feb 19th, 2020
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.65 KB | None | 0 0
  1. #include <LiquidCrystal.h>
  2.  
  3. LiquidCrystal MiPantallita (2,3,4,5,6,7);
  4. #include <Servo.h>
  5.  
  6. Servo miServito;
  7. #include <IRremote.h>
  8. const int pinServo =9;
  9. int RedLed = 10;
  10. int GreenLed = 11;
  11. const int RECV_PIN = 12;
  12. int buttonPin=13;
  13. int readValue;
  14.  
  15. IRrecv irrecv(RECV_PIN);
  16. decode_results results;
  17.  
  18. void setup(){
  19. Serial.begin(9600);
  20. miServito.attach(pinServo);
  21. irrecv.enableIRIn();
  22. irrecv.blink13(true);
  23. pinMode(GreenLed, OUTPUT);
  24. pinMode (RedLed, OUTPUT);
  25. digitalWrite(GreenLed, 1);
  26. digitalWrite(RedLed, 1);
  27. delay(10);
  28.  
  29.  
  30. MiPantallita.begin (16,2);
  31. MiPantallita.setCursor (2,0);
  32. MiPantallita.print ("lie detector");
  33. }
  34.  
  35. void loop(){
  36. if (irrecv.decode(&results)){
  37. Serial.println(results.value, DEC);
  38. irrecv.resume();
  39. }
  40. if (results.value == 16724175)
  41. {
  42. Serial.println(" I am in 1");
  43. digitalWrite (GreenLed, HIGH);
  44. digitalWrite (RedLed, LOW);
  45. //servo move to green area
  46. MiPantallita.begin (16,2);
  47. MiPantallita.setCursor (4,0);
  48. MiPantallita.print ("truth");
  49. miServito.write (150);
  50.  
  51. }
  52. if (results.value ==16718055)
  53. {
  54. Serial.println(" I am in 2");
  55. digitalWrite (GreenLed, LOW);
  56. digitalWrite (RedLed, HIGH);
  57. // servo move to lier section
  58. MiPantallita.begin (16,2);
  59. MiPantallita.setCursor (4,0);
  60. MiPantallita.print ("lie");
  61. miServito.write (30);
  62. }
  63. if (results.value == 16743045)
  64. {
  65. Serial.println(" I am in 3");
  66. digitalWrite (GreenLed, LOW);
  67. digitalWrite (RedLed, LOW);
  68. MiPantallita.begin (16,2);
  69. MiPantallita.setCursor (2,0);
  70. MiPantallita.print ("lie detector");
  71.  
  72. }
  73. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement