I want to set an alarm with a specified serially read time I've tried every thing i can ,I even created a new function inside the library but nothing get me there
I need Help
void loop() {
digitalClockDisplay();
Alarm.delay(1000);
if (Serial.available()>0)
{
char setString[TIME_SET_StrLen];
int index = 0;
char c = Serial.read();
if( c != '[')
return; // first character must be opening square brackets
do
{
c = Serial.read();
if( isdigit(c)) // non numeric characters are discarded
setString[index++] = c -'0'; // convert from ascii
}
while (c != ']'); // wait for trailing square brackets
int count = index;
int element = 0;
for( index = 0; index < count; index += 2) // step through each pair of digits
{
int val = setString[index] * 10 + setString[index+1] ; // get the numeric value of the next pair of numbers
switch( element++){
case 0 : Hour = val; break;
case 1 : Minute = val; break;
case 2 : Second = val; break;
}
} }
Serial.print(Hour );
Serial.print(Minute);
Serial.print(Second);
Serial.println("go to school");
Alarm.alarmRepeat(20,20,0, MorningAlarm);
Alarm.alarmRepea(Hour,Minute,Second,EveningAlarm); // my new function it works fine but not with serial date
}
the function on the library
AlarmID_t TimeAlarmsClass::alarmRepea(int H, int M, int S, OnTick_t onTickHandler){
return create( AlarmHMS(H,M,S), onTickHandler, IS_ALARM, IS_REPEAT );
}