0% found this document useful (0 votes)
5 views2 pages

Arduino Stepper Motor Control Code

The document contains an Arduino sketch for controlling a stepper motor using four buttons. It initializes the stepper motor and sets up button inputs, allowing the motor to step a specified number of revolutions based on button presses. However, there are several syntax errors and logical issues in the code that need to be corrected for proper functionality.

Uploaded by

babamariko008
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views2 pages

Arduino Stepper Motor Control Code

The document contains an Arduino sketch for controlling a stepper motor using four buttons. It initializes the stepper motor and sets up button inputs, allowing the motor to step a specified number of revolutions based on button presses. However, there are several syntax errors and logical issues in the code that need to be corrected for proper functionality.

Uploaded by

babamariko008
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

# include <Stepper.

h>
#define STEPS21
int stepIN1Pin=8;
int stepIN2Pin=9;
int stepIN3Pin=10;
int stepIN4Pin=11;
int stepsPerRevolution=2045;
const int button1Pin=2;
const int button2Pin=3;
const int button3Pin=4;
const int button4Pin=5;
Stepper myStepper(stepsPerRevolution, stepIN1Pin, stepIN2Pin,
stepIN3Pin, stepIN4Pin, stepIN4Pin);

void setup() {
// put your setup code here, to run once:
[Link](9600);
pinMode(button1Pin,INPUT);
pinMode(button2Pin,INPUT);
pinMode(button3Pin,INPUT);
pinMode(button4Pin,INPUT);
[Link](900);
}

void loop() {
// put your main code here, to run repeatedly:
int button1State;
int button2State;
int button3State;
int button4State;
button15State=digitalRead(button1Pin);
if ((button1State==HIGH)&&!(button2State==LOW))
{
[Link](steppsPerRevolution=);

}
button2State=digitalRead(button2Pin);
if ((button2State==HIGH)&&!(button1State==HIGH))
{
[Link](steppsPerRevolution=);

}
button15State=digitalRead(button1Pin);
if ((button2State==HIGH)&&!(button1State==HIGH))
{
[Link](steppsPerRevolution=);

}
button15State=digitalRead(button1Pin);
if ((button1State==HIGH)&&!(button1State==HIGH))
{
[Link](stepsPerRevolution=);

}
}

You might also like