Close

Clock(April 22th)

A project log for Mechanical Clock

A clock

maxandrelenamaxandre.lena • 05/12/2025 at 16:16•0 Comments

We have modified the motor code, and the gears attached to the motor now make 6 revolutions in 1 minute. So that the ratio between the gears is correct. Finally, our motor turns counterclockwise

#include <Stepper.h>

const int stepsPerRevolution = 2048; // Steps for one full revolution

// Pin configuration for the 28BYJ-48 motor
Stepper myStepper(stepsPerRevolution, 8, 10, 9, 11);

void setup() {
  // Set speed to 6 revolutions per minute
  myStepper.setSpeed(6);
}

void loop() {
  // Continuously rotate the motor at 6 RPM
  myStepper.step(-1); // One step at a time, speed controlled by setSpeed()
}

Discussions