Example |
#include <stdio.h>
#include "lib.h"
void main( void )
{
struct time at = {0};
bool alarmOn = false;
AutoPowerDown(ON, 2*50);
AutoPowerDown(APD_SHUTDOWN_ON, 60*50);
Sound(TSTANDARD, VHIGH, SLOW, SMEDIUM, SHIGH, SLOW, SMEDIUM, SHIGH, 0);
for(;;)
{
if(getchar() != EOF)
{
GoodReadLed(GREEN_FLASH, 0);
GetTime(&at);
at.ti_min = (at.ti_min+2) % 60;
at.ti_hour += (at.ti_min < 2) ? 1 : 0;
SetAlarm(&at, ON);
alarmOn = true;
Sound(TSTANDARD, VHIGH, SMEDIUM, SHIGH, 0);
printf("\rALARM SET\r%02d:%02d\rwaiting...", at.ti_hour, at.ti_min);
}
if(alarmOn != IsAlarmOn())
{
alarmOn = false;
Sound( TSTANDARD, VHIGH, SLOW, SMEDIUM, SHIGH, 0);
GoodReadLed(GREEN_FLASH, 30*50);
}
Idle();
}
}
|