Re: Serial read question

Hi there,

I am new to Arduino as well as this forum.

I am currently using Arduino UNO and DS3231 to print Time in Serial Monitor as shown below :--

21:59:57
21:59:58
21:59:59
22:00:00
22:00:01
22:00:02

What I want from Arduino to read the time 22:00:00 either from Serial Monitor or directly through DS3231 and execute some task,suppose "digitalWrite, HIGH" the LED and when the time reaches to 22:00:59, the LED should be OFF.

Any assistance would be Appreciated..

iTECHKING:
...
...

I've reported your post; a moderator will probably split it of. You should have started your own thread for this :wink:

iTECHKING:
What I want from Arduino to read the time 22:00:00 either from Serial Monitor or directly through DS3231 and execute some task,suppose "digitalWrite, HIGH" the LED and when the time reaches to 22:00:59, the LED should be OFF.

Your description is not clear.

Do you want to be able to enter a time on the Serial Monitor and then have the Arduino check the time from the RTC and act when it matches the entered time?

There is a simple user-input example in Planning and Implementing a Program

...R

Robin2:
Your description is not clear.

Do you want to be able to enter a time on the Serial Monitor and then have the Arduino check the time from the RTC and act when it matches the entered time?

There is a simple user-input example in Planning and Implementing a Program

...R

No, Not as you say.
Let me explain. I have uploaded a program in Arduino Uno to show the current date and time.
Arduino shows the current date and time running in RTC through Serial Monitor window.
Now, I want Arduino to execute a task when it reaches to a pre-defined time (say 09:00:00).
As the time in RTC reached to 9 AM, a task should be executed.
Hope I am clear now.

iTECHKING:
Now, I want Arduino to execute a task when it reaches to a pre-defined time (say 09:00:00).
As the time in RTC reached to 9 AM, a task should be executed.

Where will the pre-defined time come from - will it be in your program code? I had assumed you wanted to enter it (i.e. to be able to change it) from the Serial Montor.

If you want more help please also post your program so we can see what you are trying and what libraries you may be using.

And when posting code please use the code button </>so your code looks like thisand is easy to copy to a text editor See How to use the Forum

...R

Robin2:
Where will the pre-defined time come from - will it be in your program code? I had assumed you wanted to enter it (i.e. to be able to change it) from the Serial Montor.

If you want more help please also post your program so we can see what you are trying and what libraries you may be using.

And when posting code please use the code button </>

so your code looks like this

and is easy to copy to a text editor See How to use the Forum

...R

Yes, you got exactly what I want to say. The predefined time will be defined in the Arduino program.

#include <Wire.h>
#include "ds3231.h"
int LedOnTime=1800;    // Time 24 hours time format at which LED should be ON
int LedOffTime=1900;    // Time 24 hours time format at which LED should be OFF

void setup()
{
   
   ---
   ---
 }

void loop
(
   //  code to keep monitoring the RTC to reach predefined time and as soon as RTC
reaches "LedOnTime" , it should execute a task.
}

iTECHKING:
Yes, you got exactly what I want to say. The predefined time will be defined in the Arduino program.

Then I don't understand why you said this in your Original Post

I want from Arduino to read the time 22:00:00 either from Serial Monitor or directly through DS3231

The program you posted in Reply #5 has nothing useful in it - not even code to get the time from the RTC. At the very least put that in.

What format does the RTC give the time in?
Your comparison code must use the same format, or convert the RTC format to match your code.

...R