Untitled
unknown
plain_text
10 months ago
597 B
10
Indexable
const int motorPin3 = 7; // IN3
const int motorPin4 = 6; // IN4
const int enB = 5; // ENB pin
int speed = 255;
void setup(){
Serial.begin(9600);
pinMode(motorPin3, OUTPUT);
pinMode(motorPin4, OUTPUT);
pinMode(enB, OUTPUT);
digitalWrite(motorPin3, HIGH);
digitalWrite(motorPin4, LOW);
analogWrite(enB, speed); // Enable Motor B with PWM
// Forward
delay(2000);
speed = 155;
analogWrite(enB, speed);
delay(60000);
speed = 0;
analogWrite(enB, speed);
digitalWrite(motorPin3, LOW);
digitalWrite(motorPin4, LOW);
}
void loop(){
// Empty loop
}
Editor is loading...
Leave a Comment