Advertisement
makispaiktis

Arduino - Αμάξι πάει μπροστά (in1, in4 = 255)

Apr 16th, 2019 (edited)
264
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. //in1 high  in2 low mprosta (de3ia)
  9. //in4 high  in3 low mprosta (aristera)
  10.  
  11. void setup() {
  12.   // put your setup code here, to run once:
  13.   pinMode(in1, OUTPUT);
  14.   pinMode(in2, OUTPUT);
  15.   pinMode(in3, OUTPUT);
  16.   pinMode(in4, OUTPUT);
  17.  
  18. }
  19.  
  20. void loop() {
  21.   // put your main code here, to run repeatedly:
  22.   if (flag) {
  23.     analogWrite(in1, 255);
  24.     analogWrite(in2, 0);
  25.     analogWrite(in3, 0);
  26.     analogWrite(in4, 255);  
  27.   }
  28.  
  29.   delay(4000);
  30.  
  31.  
  32.   analogWrite(in1, 0);
  33.   analogWrite(in2, 0);
  34.   analogWrite(in3, 0);
  35.   analogWrite(in4, 0);
  36.  
  37.   flag = false;
  38.  
  39.  
  40.  
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement