that_one_nigga_you_k

teste do motor

Mar 8th, 2018
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.44 KB | None | 0 0
  1. #include <L298N.h>
  2.  
  3. //pin definition
  4. #define EN1 9
  5. #define IN1 4
  6. #define IN2 5
  7. #define EN2 10
  8. #define IN3 6
  9. #define IN4 7
  10.  
  11. //create a motor instance
  12. L298N motor1(EN1,IN1,IN2);
  13. L298N motor2(EN2,IN3,IN4);
  14.  
  15. void setup() {
  16.  
  17.   //used for display information
  18.   Serial.begin(9600);
  19.  
  20.   motor1.setSpeed(175); // an integer between 0 and 255
  21.   motor2.setSpeed(175);
  22. }
  23.  
  24. void loop() {
  25.   motor1.forward();
  26.  
  27.   motor2.forward();
  28.  
  29.  
  30.  
  31. }
Add Comment
Please, Sign In to add comment