Guest User

Untitled

a guest
Feb 23rd, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. const int sigPin = 0; // set number of the tilt switch pin D3 (0)
  2. boolean sigState = 0; // set tilt switch status
  3.  
  4.  
  5. void setup() {
  6. // initialize the tilt switch pin as an input:
  7. pinMode(sigPin, INPUT);
  8. //Init Serial
  9. Serial.begin(9600);
  10. }
  11.  
  12. void loop() {
  13. // read the state of the tilt switch value:
  14. sigState = digitalRead(sigPin);
  15. if (sigState == HIGH)
  16. {
  17. Serial.println("Ativado.");
  18. }
  19. else
  20. {
  21. Serial.println("Desativado.");
  22. }
  23.  
  24. }
Add Comment
Please, Sign In to add comment