Main Site Documentation

Alarm Clock


#1

Hi

I want to trigger an event on a specific time (tomorrow at 10 or something)

I do like this: (i set the time according data from a sms (gprs modem))
RealTimeClock.SetTime(new DateTime(Convert.ToInt16(tmpDate[0]), Convert.ToInt16(tmpDate[1]), Convert.ToInt16(tmpDate[2]), Convert.ToInt16(tmpTime[0]), Convert.ToInt16(tmpTime[1]), 0, 0));

(I set the alarm to 30 seconds later for testing)
RealTimeClock.SetAlarm(new DateTime(Convert.ToInt16(tmpDate[0]), Convert.ToInt16(tmpDate[1]), Convert.ToInt16(tmpDate[2]), Convert.ToInt16(tmpTime[0]), Convert.ToInt16(tmpTime[1])+30, 0, 0));

But what is being triggered? how do i read that the alarm has been triggered?

if (alarmtriggered)
{
do stuff
}

Can anybody help ??

Br. Michael


#2

Welcome to the forum.

“This feature lets the user specify an alarm time. This can be used to drive the ALARM pin high or wakeup the processor from hibernation.
The alarm pin is an RTC controlled output. This is a 1.8 V pin. The pin goes low when the alarm time is specified. It goes HIGH when an RTC alarm is generated.
The RTC can supply battery power to the ALARM pin and that can be used by external hardware to restore module power and resume operation.”


#3

Thanks

Yes i read that somewhere -> but can i read the state of that pin from SW?
And what pin is that on a Panda II ?

Br. Michael


#4

Thats IO69


#5

IO69???

Where is that pin -> Does The FEZ Panda 2 not only have up to Pin52 (D52) ???

Or am i misunderstanding something ???

Michael


#6

#7

I can see the IO69 on a PANDA, but not on PANDA2


#8

It is just not exposed on Panda II it is still there you just need to read it in the code.


#9

I tried this:

OutputPort ALARM;
ALARM = new OutputPort((Cpu.Pin)69, false);

But this gives an error -> throws an exception!

Can you please tell me how i should do this -> as far as i can see there is no FEZ_Pin for it?

Forgive me for all my questions, its my first FEZ project :wink:

Michael


#10

Try InputPort


#11
   InputPort ALARM;
        ALARM = new InputPort((Cpu.Pin)69 , false, Port.ResistorMode.Disabled);

An unhandled exception of type ‘System.Exception’ occurred in Microsoft.SPOT.Hardware.dll


#12

I think alarm pin is not gpio and can’t be read directly.


#13

So how should i solve this issue???


#14

Use software timers. No need to use RTC all together.