Advertisement
gabbyshimoni

runDCmotorL298n

Jan 29th, 2019
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.46 KB | None | 0 0
  1. /*
  2.  * 29/01/2019
  3.  * Written by: Shimoni Gabby
  4.  * Description:
  5.  * The program run a DC motor full speed in one direction via L298n motor driver
  6.  */
  7.  #define motor1Pin 5
  8.  #define motor2Pin 6
  9. void setup() {
  10.  pinMode(motor1Pin,OUTPUT);
  11.  pinMode(motor2Pin,OUTPUT);
  12. }
  13.  
  14. void loop() {
  15.   //start motor
  16.  digitalWrite(motor1Pin,HIGH);
  17.  digitalWrite(motor1Pin,LOW);
  18.  delay(3000);
  19.  // stop motor
  20.  digitalWrite(motor1Pin,HIGH);
  21.  digitalWrite(motor2Pin,HIGH);
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement