Code used for testing motor driver and the motors
posted 1 year, 9 months ago by Alex JV


int val=255;
void setup() {
pinMode(13, OUTPUT);
pinMode(12, OUTPUT);
Serial.begin(9600);
// pinMode(11, OUTPUT);
}

void loop() {
analogWrite(11,val);
// digitalWrite(11, HIGH);

digitalWrite(12, LOW);
digitalWrite(13, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(12, HIGH);
digitalWrite(13, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second

Serial.print("val= ");
Serial.println(val);
val = val-10;
if (val<0)
{
val=255;
}

}

Comments