Can anyone offer guidance as to why my program wont work. Im new to arduino and I want to call a series of functions within eachother but for some reason i cant get the first function to switch over to the second.
#include <LiquidCrystal.h>
#include <Stepper.h>
//Start the time at 0
int time = 0;
//Initialize the library with the numbers of the interface pins
LiquidCrystal lcd(2, 3, 4, 5, 6, 7); // correspond to RS,EN,D4,D5,D6,D7
int stepIN1Pin = 8;
int stepIN2Pin = 9;
int stepIN3Pin = 10;
int stepIN4Pin = 11;
int stepIN1Pin1 = 52;
int stepIN2Pin1 = 53;
int stepIN3Pin1 = 50;
int stepIN4Pin1 = 51;
int stepsPerRevolution = 2048; // amount of steps per revolution
const int button1Pin = 2; // pushbutton 1 pin for clockwise
const int button2Pin = 3; // pushbutton 2 pin for no rotation
Stepper myStepper(stepsPerRevolution, stepIN1Pin, stepIN3Pin, stepIN2Pin, stepIN4Pin);
Stepper myStepper1(stepsPerRevolution, stepIN1Pin1, stepIN3Pin1, stepIN2Pin1, stepIN4Pin1);
Stepper myStepper2(stepsPerRevolution, stepIN1Pin2, stepIN3Pin2, stepIN2Pin2, stepIN4Pin2);
void Question1(){
lcd.begin(16, 2);
// Print a message to the LCD.
lcd.print("function1");
int button1State, button2State;
button1State = digitalRead(button1Pin);
button2State = digitalRead(button2Pin);
if (button1State == HIGH){ // if we're pushing button 1 OR button 2
delay(1000);
myStepper.step(stepsPerRevolution/8);
Question2();
}
if (button2State == HIGH){
myStepper.step(0);
Question2();
}
}
void Question2(){
lcd.begin(16, 2);
// Print a message to the LCD.
lcd.print("function2");
int button1State, button2State;
button1State = digitalRead(button1Pin);
button2State = digitalRead(button2Pin);
if (button1State == HIGH){ // if we're pushing button 1 OR button 2
delay(1000);
myStepper1.step(stepsPerRevolution/8);
//Question3();
}
if (button2State == HIGH){
myStepper1.step(0);
//Question3();
}
}
void setup()
{
pinMode(button1Pin, INPUT);
myStepper.setSpeed(15);
myStepper1.setSpeed(15);
Question1();
// myStepper2.setSpeed(15);
// myStepper3.setSpeed(15);
// myStepper4.setSpeed(15);
}
void loop()
{
void Question1();.
}