Advertisement
manvi_m

LED stays on until arduino is unplugged

Jun 7th, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. /*
  2. * Manvi Mittal
  3. * Version 1
  4. * Leaning digital imputs
  5. */
  6.  
  7. const int pinLed = 7;
  8. const int pinButton = 2;
  9. int readValue = 0;
  10.  
  11. void setup()
  12. {
  13. // put your setup code here, to run once:
  14. pinMode (pinButton, INPUT);
  15. pinMode (pinLed, OUTPUT);
  16.  
  17. Serial.begin (9600);
  18.  
  19. digitalWrite (pinLed, HIGH);
  20. delay (50);
  21. digitalWrite (pinLed, LOW);
  22.  
  23. }
  24.  
  25. void loop()
  26. {
  27. // put your main code here, to run repeatedly:
  28. readValue = digitalRead (pinButton);
  29.  
  30. if(readValue == 1)
  31. {
  32. digitalWrite (pinLed, HIGH);
  33. }
  34.  
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement