110
Sensaphone® ISACC Instruction Manual
recent = input(1); /* Get the value from input 1 */
if ((hours==6)&&(prvhrs!=6)) /* This segment of code runs only when the hours change to */
{ /* 6 o’clock */
total = total + recent;
average = total / 24;
prvhrs=hours; /* This prevents the previous IF statement from executing */
} /* more than once during the hour of 6 o’clock */
}
4. This example shows: PUSH BUTTON RESET and SINGLE ALARM FOR POWEROUTAGE. Note that the push button is an open/close button attached to input 14.
int i,was_alm,step,cncl,ocncl;
main()
{
if ((input(20)==0)&&(was_alm==0)) /* Only if new power outage*/
{
was_alm=1; alarm(15);
}
if (input(20)==1) /* Power back on */
{
was_alm=0;
}
cncl=input(14);
if (cncl!=ocncl) /* If push button changed state */
{
ocncl=cncl;
if (cncl==0)
{
step=1; /* Push button reset */
}
}
if (step==2)
{
for (i=1;i<17;i=i+1)
{
enable(i,1); /* Enable all alarms */
}
step=0;
}
if (step==1)
{
for (i=1;i<17;i=i+1)
{
enable(i,0); /* Disable all alarms */
}
step=2;
}
}