KingOfWesteros

AUla 04 - Motor CC + Ponte H

Apr 21st, 2021
844
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ---Ponte H L293D---
  2.  
  3. //Declaração das variáveis
  4. int m1a = 13;
  5. int m1b = 12;
  6. int m2a = 11;
  7. int m2b = 10;
  8.  
  9. void setup()
  10. {
  11.   pinMode(m1a, OUTPUT);
  12.   pinMode(m1b, OUTPUT);
  13.   pinMode(m2a, OUTPUT);
  14.   pinMode(m2b, OUTPUT);
  15. }
  16.  
  17. void loop()
  18. {
  19.   paraFrente();
  20.   delay(3000);
  21.   paraTras();
  22.   delay(3000);
  23. }
  24.  
  25. void paraFrente() {
  26.   digitalWrite(m1a, LOW);
  27.   digitalWrite(m1b, HIGH);
  28.  
  29.   digitalWrite(m2a, LOW);
  30.   digitalWrite(m2b, HIGH);
  31. }
  32.  
  33. void paraTras() {
  34.   digitalWrite(m1a, HIGH);
  35.   digitalWrite(m1b, LOW);
  36.  
  37.   digitalWrite(m2a, HIGH);
  38.   digitalWrite(m2b, LOW);
  39. }
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×