#include <Stepper.h>
#include <LiquidCrystal_I2C.h>
// Inisialisasi objek untuk LCD dengan koneksi I2C
LiquidCrystal_I2C lcd(0x27, 16, 2); // Alamat I2C dan ukuran LCD
const int stepsPerRevolution = 200;
Stepper stepper1(stepsPerRevolution, 2, 3, 4, 5);
Stepper stepper2(stepsPerRevolution, 8, 9, 10, 11);
void setup() {
// Inisialisasi LCD
lcd.init();
lcd.backlight();
lcd.setCursor(0, 0);
lcd.print("Kelompok 2");
// set the speed at 20 rpm for one stepper
stepper1.setSpeed(20);
stepper2.setSpeed(20);
// initialize the serial port:
Serial.begin(9600);
}
void loop() {
// step one revolution in one direction:
Serial.println("clockwise");
lcd.setCursor(0, 1);
lcd.print("clockwise");
stepper1.step(stepsPerRevolution);
stepper2.step(stepsPerRevolution);
delay(500);
// step one revolution in the other direction:
Serial.println("counter clockwise");
lcd.setCursor(0, 1);
lcd.print("counterclockwise");
stepper1.step(-stepsPerRevolution);
stepper2.step(-stepsPerRevolution);
delay(500);
}