// Stepper motor on Wokwi!
#include <Stepper.h>
int hours;
int minutes;
int seconds;
void time1_setup()
{
Serial.println(" ");
Serial.println("DS3231 based Clock and Calender");
//Take in the time values from the user
Serial.println("Enter the hours : ");
while(Serial.available() == 0) { } // Wait for user input
hours = Serial.parseInt();
Serial.print("hours : ");
Serial.println(hours);
}
void time2_setup()
{
//Take in the time values from the user
Serial.println("Enter the minutes : ");
while(Serial.available()== 0 ){ } // Wait for user input
minutes = Serial.parseInt();
Serial.print("minutes : ");
Serial.println(minutes);
delay(20);
}
void time3_setup()
{
//Take in the time values from the user
Serial.println("Enter the seconds : ");
while(Serial.available() == 0) { } // Wait for user input
seconds = Serial.parseInt();
Serial.print("seconds : ");
Serial.println(seconds);
delay(20);
}
void time ()
{
Serial.print("Time is ");
Serial.print(hours);
Serial.print(":");
Serial.print(minutes);
Serial.print(":");
Serial.println(seconds);
}
void setup()
{
//Set the Baud Rate
Serial.begin(9600);
Serial.setTimeout(100);
time1_setup();
delay(100);
while (Serial.available() > 0) {//受信バッファクリア
char t = Serial.read();
}
time2_setup();
delay(100);
while (Serial.available() > 0) {//受信バッファクリア
char t = Serial.read();
}
time3_setup();
time();
}
void loop()
{
}