Hi folks, hoping someone can help me. Im writing a sketch and having some trouble with something no doubt is insanely easy, but I cant find anything about it on-line. I want it to follow a set program then stop, but instead once its completed said task it continues to repeat it.
My program is:
/*
motor driver control.
*/
int motor1APin = 6; // H-bridge leg 1
int motor2APin = 7; // H-bridge leg 2
void setup()
{
pinMode(motor1APin, OUTPUT);
pinMode(motor2APin, OUTPUT);
}
void loop()
{
digitalWrite(motor1APin, LOW); // set leg 1 of the H-bridge low
digitalWrite(motor2APin, HIGH); // set leg 2 of the H-bridge high
delay (5000);
digitalWrite(motor1APin, LOW); // set leg 1 of the H-bridge low
digitalWrite(motor2APin, LOW); // set leg 2 of the H-bridge low
delay (1000);
digitalWrite(motor1APin, HIGH); // set leg 1 of the H-bridge low
digitalWrite(motor2APin, LOW); // set leg 2 of the H-bridge high
delay (5000);
digitalWrite(motor1APin, LOW); // set leg 1 of the H-bridge low
digitalWrite(motor2APin, LOW); // set leg 2 of the H-bridge low
}
this is basically a circuit set up with a H Bridge IC Chip for changing the direction of a motor, but i need it to completely stop after this set of tasks. When using PBasic you can just write "end" at the end which would stop it- is there an alternative for this?
Ive just realised its in a void loop() - could that be it?
Any help is greatly appreciated!!