programming help

Dear all.

I wanna write simple code for arduino board.

Assume that i have real time clock. I wanna min value of time and recorded in variable once @ time. I could able to reset the variable after 10 min . can some help me how can we achieve this

pseudo code:

previous value<--preset value
check ( present value-previous value== 10 min)
if yes
reset preset value and print hello

if not
print welcome

previous value should recorded only once

Have you got any real code to which this requirement is to be added ?

Can you explain more clearly what you want to do ?
What is to be recorded and when ?

i wanna simple code in c where i can expect result as above psedo code

assume i have RTC which give me hour/min/sec

@ first i wanna record present min,
then after 10 min i wanna print "hello" and update the present value

this step has executed every 10 min

The phrase you're struggling with is "want to".

if i understand the problem correctly here is a possible solution

void loop(){
float hour = //your current time from sensor
float min = //
float sec = //

for (i=0; i < 10, i++){
delay(60000) //here you have to ensure that the arduino can delay for 1 min, iif not you have to create nested loops
}

Serial.print("Hello");// whatever else you want to type

}//end of void loop

In this below program it gives delay 1 min .

what i wanna do is keep updating previous value with new newly recorded value of time.

Assume i have time 10h10m10s
assume previous value has 00m @ start
now hence 10 min passed it will update previous value to 10 from 0 and current value keep incrementing..

when(current value-previous value is 10 min )
update previous to current and print message
else incrementing current value

float hour = //

You have fractional hours?

no . it doesnot matter .

I have integer value for assigning the min and hour

Dear all,

Can some one share me the simple code where i can update the current value to previous value.

assume i have RTC , Where i wanna record time for every 10 min with current one. reason i wanna do that for every 10 min i wanna actuate motor.
pseudo code :

previous time = current time:
if ( current time-previous time>=10 min)
print "hello" and update previous time == current time and turn on motor
else
print "welcome" and keep counting current time and turn off motor

i need simple c code for above .

i am using arduino board uno board.i don't want use delay timer .since some code might get affected

previous time = current time:
if ( current time-previous time>=10 min)
print "hello" and update previous time == current time and turn on motor

If you set previous time to current time, how the hell is the difference ever going to be greater than 10 minutes?

Post some REAL code - in this thread. DO NOT START ANOTHER ONE.

How are you getting the time? Current, real, imaginary, or phantom?

Dear all.

How can simple c code for arduino UNO board to update the values every 10 min

assume i have motor and rtc

pseudo code i am looking for:

previous time =0;
current time ;
if (current time -previous time ==10 min)
print hello, update previous time to current time and turn on the motor
else
print welcome , current value keep incrementing till 10 min reached and turn off motor

i don't want use delay function here . Using normal counter or variable how can achieve above code.previous time recorded one @ time and get updated after it complete 10 min.

i hope someone help me out

in below code i am saying that,

previous value get update current value only first time execution
after that difference should get varied .
after completion of 10 min . previous value get updated with the current .motor should start

i have mentioned that i have real time clock. where i am getting time

Reported to moderators. This spamming has got to stop.

You need to do SOMETHING on your own.

Topics merged.

OP - don't repeat this.

in below code i am saying that,

There is no code below (unless your monitor is upside-down)

There are PLENTY of RTC code in either here or project guidence, that do something after a certain time has passed. Most, if not ALL have examples. Find them, read them, learn from them, and write your own. Come back when you have an actual code that compiles or at least has some errors that make sense based on what you wrote.

No code, no help.

i checked in forum but i could not able to fined it. Can some help me writing code .
I know psedo code write:

Assume i have rtc and motor

I have attached RTC code below. where i am getting date and time for set values.

now,I wanted to reset the previous time to current time every 10 min.when updatd motor get on and led pin 13 should high

pseudo code
previous time ==0; intially
current time = m;
check( current time- previous time)>10=10 min)
if yes previous time== current time, motor on, led 13 goes high
if not current time ++; motor should off , led 13 goes low

HazardsMind:
There are PLENTY of RTC code in either here or project guidence, that do something after a certain time has passed. Most, if not ALL have examples. Find them, read them, learn from them, and write your own. Come back when you have an actual code that compiles or at least has some errors that make sense based on what you wrote.

No code, no help.

code.zip (1.41 KB)

I am having trouble understanding what you want to do.

Your pseudo code seems to come down to "wait 10 mins then turn the LED and motor on"
Is that what you want or do you want ?

yes i wanna wait for 10 min, When difference is equal to 10 min motor should on few min and led goes high ,
when difference less than 10 min it should be off and led pin goes low

Have you had a look at the BlinkWithoutDelay example in the IDE ?

That essentially does what you want. It waits a while (you define the waiting time), turns on an LED, waits a while then turns it off. As it stands the on/off periods are equal but you could change that behaviour.