ScienceGeyser

MotorRunCode

Jun 9th, 2021 (edited)
603
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. void run_()     // ahead
  2. {
  3.   digitalWrite(Left_motor_go,HIGH);  // set left motor go ahead
  4.   digitalWrite(Left_motor_back,LOW);
  5.   digitalWrite(Right_motor_go,HIGH);  // right motor go ahead
  6.   digitalWrite(Right_motor_back,LOW);
  7.   analogWrite(Left_motor_en,157); // set motor speed  
  8.   analogWrite(Right_motor_en,200);//PWM--Pulse Width Modulation(0~255). right motor go speed is 255.
  9.   delay(100);// Set motor run time
  10.   analogWrite(Left_motor_en,0); // set motor speed to zero
  11.   analogWrite(Right_motor_en,0);// set motor speed to zero
  12. }
  13.  
RAW Paste Data