Being very new to programing I am trying to drive a 12v stepper motor with a Teensy 3.2 and an H-Bridge.
I want the program to run a stepper clockwise when pushing button A, until you release the switch or it hits the limit switch. A button B, and limit switch, run it counterclockwise.
I found a example sketch that I'm wanting to learn from but get a compile error - "default arguments are only permitted for function parameters" when it reaches "int a = analogRead(A0); immediately after "void loop()".
I think it has to do with declaring the input pins A0 and A1, or lack thereof. I think I have a grasp on hookup of the teensy, bridge and switches but can't go forward until I can get the program to compile.
Any help would be appreciated.
Here is the code -
#include <Stepper.h>
const int stepsPerRevolution = 200;
Stepper myStepper(stepsPerRevolution, 4, 6, 5, 7);
void setup() {
myStepper.setSpeed(200);
int a = 0;
int b = 0;
}
void loop() (
int a = analogRead(A0);
int b = analogRead(A1);
if (a==0){
myStepper.step(stepsPerRevolution);
}
else if (b==0){
myStepper.step(-stepsPerRevolution)
}
I want the program to run a stepper clockwise when pushing button A, until you release the switch or it hits the limit switch. A button B, and limit switch, run it counterclockwise.
I found a example sketch that I'm wanting to learn from but get a compile error - "default arguments are only permitted for function parameters" when it reaches "int a = analogRead(A0); immediately after "void loop()".
I think it has to do with declaring the input pins A0 and A1, or lack thereof. I think I have a grasp on hookup of the teensy, bridge and switches but can't go forward until I can get the program to compile.
Any help would be appreciated.
Here is the code -
#include <Stepper.h>
const int stepsPerRevolution = 200;
Stepper myStepper(stepsPerRevolution, 4, 6, 5, 7);
void setup() {
myStepper.setSpeed(200);
int a = 0;
int b = 0;
}
void loop() (
int a = analogRead(A0);
int b = analogRead(A1);
if (a==0){
myStepper.step(stepsPerRevolution);
}
else if (b==0){
myStepper.step(-stepsPerRevolution)
}