Hi, i have looked on google to see how it is done and i only found one source. I connected it up and got the motor running, but it doesnt seem like its the best way to do it or im missing something because i cant even write simple code to just have the motor run for a few seconds and then to stop, and perhaps run the opposite direction.
here is an example of the code. pin 8 is Direction for the driver, and 9 is for the pulse. When i decrease the value of the delay, it runs faster. Ive tried to add a "break;" command to the end to stop the loop after the first iteration but i get a syntax error. Is there a standard library i need to import, as well as a library to code these things?
void setup()
{
pinMode(8, OUTPUT);
pinMode(9, OUTPUT);
digitalWrite(8, LOW);
digitalWrite(9, LOW);
}void loop()
{
digitalWrite(9, HIGH);
delayMicroseconds(500);
digitalWrite(9, LOW);
delayMicroseconds(500);
}
also, can someone clear up whats actually happening, when i set 9 to high, which means it sends 5v to the driver for how ever many seconds i set the "delay", shouldnt the motor constantly turn during that duration?