Advertisement
makispaiktis

Arduino - Αμάξι μπροστά για 4s και μετά σταματάει μόνιμα

Apr 16th, 2019 (edited)
306
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #define in1 6
  2. #define in2 5
  3. #define in3 9
  4. #define in4 3
  5.  
  6. bool flag = true;
  7.  
  8. void setup() {
  9.   pinMode(in1, OUTPUT);
  10.   pinMode(in2, OUTPUT);
  11.   pinMode(in3, OUTPUT);
  12.   pinMode(in4, OUTPUT);
  13.  
  14.  
  15. }
  16.  
  17. void loop() {
  18.  
  19.  
  20.   if(flag){
  21.     digitalWrite(in1, HIGH);
  22.     digitalWrite(in2, LOW);
  23.     digitalWrite(in3, LOW);
  24.     digitalWrite(in4, HIGH);
  25.   }
  26.  
  27.   delay(4000);
  28.  
  29.   digitalWrite(in1, LOW);
  30.   digitalWrite(in2, LOW);
  31.   digitalWrite(in3, LOW);
  32.   digitalWrite(in4, LOW);
  33.  
  34.   flag = false;
  35.  
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement