This is the error message:
Arduino: 1.8.9 (Windows Store 1.8.21.0) (Windows 10), Board: "Arduino/Genuino Uno"
C:\Users\David\Documents\Arduino\sketch_jun05a\sketch_jun05a.ino: In function 'void setup()':
sketch_jun05a:23:20: error: 'stepAClockwise' was not declared in this scope
stepAClockwise();
^
sketch_jun05a:27:20: error: 'stepAClockwise' was not declared in this scope
stepAClockwise();
^
sketch_jun05a:31:20: error: 'stepAClockwise' was not declared in this scope
stepAClockwise();
^
sketch_jun05a:35:20: error: 'stepAClockwise' was not declared in this scope
stepAClockwise();
^
sketch_jun05a:39:20: error: 'stepBClockwise' was not declared in this scope
stepBClockwise();
^
sketch_jun05a:42:27: error: 'stepACounterClockwise' was not declared in this scope
stepACounterClockwise();
^
sketch_jun05a:46:20: error: 'stepAClockwise' was not declared in this scope
stepAClockwise();
^
C:\Users\David\Documents\Arduino\sketch_jun05a\sketch_jun05a.ino: At global scope:
sketch_jun05a:53:24: error: expected unqualified-id before '{' token
void stepAClockwise(); {
^
sketch_jun05a:57:31: error: expected unqualified-id before '{' token
void stepACounterClockwise(); {
^
sketch_jun05a:61:24: error: expected unqualified-id before '{' token
void stepBClockwise(); {
^
sketch_jun05a:65:31: error: expected unqualified-id before '{' token
void stepBCounterClockwise(); {
^
exit status 1
'stepAClockwise' was not declared in this scope
And added Semicolons:
const byte EnablePin = 8;// same enable for both motor A and B
const byte MotorAStepPin = 2;
const byte MotorADirectionPin = 5;
const byte MotorBStepPin = 3;
const byte MotorBDirectionPin = 6;
void setup()
{
// setup your pins
pinMode(EnablePin, OUTPUT);
pinMode(MotorAStepPin, OUTPUT);
pinMode(MotorADirectionPin, OUTPUT);
pinMode(MotorBStepPin, OUTPUT);
pinMode(MotorBDirectionPin, OUTPUT);
digitalWrite(EnablePin, HIGH);//this and the next 4 lines set the initial pin state...
digitalWrite(MotorAStepPin, HIGH);
digitalWrite(MotorADirectionPin, HIGH);
digitalWrite(MotorBStepPin, HIGH);
digitalWrite(MotorBDirectionPin, HIGH);
// do this once.
for (byte i = 0; i < 100; i++) {
stepAClockwise();
}
delay(10000);// more complicated code will be hung on this line so learn to not use delay if you plan to expand this code.
for (byte i = 0; i < 100; i++) {
stepAClockwise();
}
delay(10000);
for (byte i = 0; i < 100; i++) {
stepAClockwise();
}
delay(10000);
for (byte i = 0; i < 100; i++) {
stepAClockwise();
}
delay(10000);
for (byte i = 0; i < 100; i++) {
stepBClockwise();
}
for (unsigned int i = 0; i < 400; i++) {// notice the change in index to accomodate the 400 range... byte has max 0-255
stepACounterClockwise();
}
delay(10000);
for (byte i = 0; i < 100; i++) {
stepAClockwise();
}
// and so on...
}
void loop();// do this ever after.
void stepAClockwise(); {
digitalWrite(MotorAStepPin, HIGH); //pins HIGH or LOW to step motor A once in a clockwise direction.
}
void stepACounterClockwise(); {
digitalWrite(MotorAStepPin, LOW); //pins HIGH or LOW to step motor A once in a counter-clockwise direction.
}
void stepBClockwise(); {
digitalWrite(MotorBStepPin, HIGH); //pins HIGH or LOW to step motor B once in a clockwise direction.
}
void stepBCounterClockwise(); {
digitalWrite(MotorAStepPin, LOW); //pins HIGH or LOW to step motor B once in a counter-clockwise direction.
}