Advertisement
B-Matt

Arduino - Timer Simple

Dec 9th, 2016
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.49 KB | None | 0 0
  1. #include "Timer.h"
  2.  
  3. Timer t;
  4. void setup() {
  5.   for(int i=2; i < 14; i++) {
  6.     pinMode(i, OUTPUT);
  7.   }
  8.  
  9.   digitalWrite(2, HIGH);
  10.   digitalWrite(3, HIGH);
  11.   digitalWrite(4, HIGH);
  12.   digitalWrite(5, HIGH);
  13.  
  14.  // t.every(2000, upaliti);
  15.  digitalWrite(2, LOW);
  16.  digitalWrite(
  17. }
  18.  
  19. void loop() {
  20.   // put your main code here, to run repeatedly:
  21.   t.update();
  22. }
  23.  
  24. int d=1;
  25. void upaliti() {
  26.   digitalWrite(d+2, HIGH);
  27.  
  28.   d++;
  29.   if(d > 3)
  30.     d = 0;
  31.  
  32.   digitalWrite(d+2, LOW);
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement