// Stepper motor on Wokwi!
#include <Stepper.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2);
const int StepperPerRound=200; //set limit steps
const int movea = 1;
Stepper myStepper(StepperPerRound, 8, 9, 10, 11);
void setup() {
myStepper.setSpeed(60);
lcd.init();
lcd.backlight();
}
void loop() {
lcd.clear();
for (int actsteps = 1; actsteps <= StepperPerRound ;actsteps=actsteps+movea)
{
lcd.setCursor(1, 0);
lcd.print("Motor Positive");
myStepper.step(movea);
lcd.setCursor(1, 1);
lcd.print(actsteps);
delay(100);
lcd.clear();
}
for (int actsteps = StepperPerRound; actsteps>0;actsteps=actsteps-movea)
{
lcd.setCursor(1, 0);
lcd.print("Motor Nagative");
myStepper.step(-movea);
lcd.setCursor(1, 1);
lcd.print(actsteps);
delay(100);
lcd.clear();
}
}