/*
A. Create a sketch that will allow a stepper motor to move and complete five revolutions
clockwise in one minute and two revolutions counterclockwise in one minute.
B. Create a sketch that will display the patterns using timers:
When analog input is greater than 2.5V from a potentiometer, display the pattern 10101010 five
times and 01010101 one time for one minute.
When analog input is less than or equal to 2.5V from the potentiometer, display the pattern
11001100 and 00110011 alternately for two minutes
*/
// Include the Stepper library
#include <Stepper.h>
int count = 0;
// Define the number of steps per revolution for your stepper motor
const int stepsPerRevolution = 200;
// Create a Stepper object with the number of steps and the pin numbers for motor control
Stepper stepper(stepsPerRevolution, 8, 9, 10, 11);
int revolution = 0;
void setup() {
// Set the speed of the stepper motor (in RPM)
stepper.setSpeed(5);
Serial.begin(9600);
}
void loop() {
// Rotate the stepper motor clockwise for 5 revolutions
// revolution = 0;
// Serial.println("dssffds");
// for (int i = 0; i < 1; ++i)
// {
// stepper.step(stepsPerRevolution);
// Serial.print("Clockwise Revolution: ");
// Serial.println(++revolution);
// }
// delay(200);
// for(int i = 0; i < 2; ++i)
// {
// revolution = 0;
// stepper.step(-stepsPerRevolution);
// Serial.print("Counter Clockwise Revolution: ");
// Serial.println(++revolution);
// }
// Delay for 1 second
// delay(1000);
// Rotate the stepper motor counterclockwise for 2 revolutions
// stepper.step(-stepsPerRevolution * 2);
// // Delay for 1 second
// delay(1000);
stepper.step(stepsPerRevolution * 5);
delay(1000); // Delay for 1 second
// Rotate the stepper motor counterclockwise for 2 revolutions
stepper.step(-stepsPerRevolution * 2);
delay(1000);
}