Guest User

teeeeeensy

a guest
May 18th, 2019
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.36 KB | None | 0 0
  1. volatile byte state = LOW;
  2.  
  3. void setup() {
  4.   pinMode(A1, INPUT);
  5.   attachInterrupt(A1, blink, CHANGE);
  6. }
  7.  
  8. void loop() {
  9.     Serial.println(state);
  10.     if (state = 1)
  11.     {
  12.       Serial.println("tryb 1");
  13.       delay(500);
  14.     }
  15.     else
  16.     {
  17.       Serial.println("tryb 2");
  18.       delay(500);
  19.     }
  20.  
  21. }
  22.  
  23. void blink() {
  24.   state = !state;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment