SHARE
TWEET

Untitled

a guest Sep 5th, 2015 355 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. int IN1 = 4;
  2. int IN2 = 5;
  3. int IN3 = 6;
  4. int IN4 = 7;
  5.  
  6. void setup()
  7. {
  8.   //Define os pinos como saida
  9.  pinMode(IN1, OUTPUT);
  10.  pinMode(IN2, OUTPUT);
  11.  pinMode(IN3, OUTPUT);
  12.  pinMode(IN4, OUTPUT);
  13. }
  14.  
  15. void loop()
  16. {
  17.  //Gira o Motor A no sentido horario
  18.  digitalWrite(IN1, HIGH);
  19.  digitalWrite(IN2, LOW);
  20.  delay(2000);
  21.  //Para o motor A
  22.  digitalWrite(IN1, HIGH);
  23.  digitalWrite(IN2, HIGH);
  24.  delay(500);
  25.  //Gira o Motor B no sentido horario
  26.  digitalWrite(IN3, HIGH);
  27.  digitalWrite(IN4, LOW);
  28.  delay(2000);
  29.  //Para o motor B
  30.  digitalWrite(IN3, HIGH);
  31.  digitalWrite(IN4, HIGH);
  32.  delay(500);
  33.  
  34.  //Gira o Motor A no sentido anti-horario
  35.  digitalWrite(IN1, LOW);
  36.  digitalWrite(IN2, HIGH);
  37.  delay(2000);
  38.  //Para o motor A
  39.  digitalWrite(IN1, HIGH);
  40.  digitalWrite(IN2, HIGH);
  41.  delay(500);
  42.  //Gira o Motor B no sentido anti-horario
  43.  digitalWrite(IN3, LOW);
  44.  digitalWrite(IN4, HIGH);
  45.  delay(2000);
  46.  //Para o motor B
  47.  digitalWrite(IN3, HIGH);
  48.  digitalWrite(IN4, HIGH);
  49.  delay(500);
  50. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top