rtc-alarm2-daily

dinosalvioni/ds3231rtc/rtc-alarm2-daily

Imposta l'Allarme2 su SQW con frequenza giornaliera ad una determinata ora/min
rtc-alarm2-daily
@/rtc-alarm2-daily
Imposta l'Allarme2 su SQW con frequenza giornaliera ad una determinata ora/min
ENboolean
Abilita/Disabilita l'allarme, alla pressione del SET
HOURnumber
Ora di allarme
MINnumber
Minuto di allarme
SETpulse
Invia i valori
rtc-alarm2-daily
EN
HOUR
MIN
SET
DONE
DONEpulse
To use the node in your project you should have the dinosalvioni/ds3231rtc library installed. Use the “File → Add Library” menu item in XOD IDE if you don’t have it yet. See Using libraries for more info.

C++ implementation

#pragma XOD require "https://github.com/JChristensen/DS3232RTC"
#pragma XOD require "https://github.com/janelia-arduino/Streaming"
#pragma XOD require "https://github.com/PaulStoffregen/Time"



{{#global}}
#include "DS3232RTC.h"
#include "Streaming.h"
#include "TimeLib.h"



{{/global}}

struct State {

};

{{ GENERATED_CODE }}

void evaluate(Context ctx) {

{


    // initialize the alarms to known values, clear the alarm flags, clear the alarm interrupt flags
    RTC.setAlarm(ALM1_MATCH_DATE, 0, 0, 0, 1);
    RTC.setAlarm(ALM2_MATCH_DATE, 0, 0, 0, 1);
  //  RTC.alarm(ALARM_1);
   // RTC.alarm(ALARM_2);
   // RTC.alarmInterrupt(ALARM_1, false);
    //RTC.alarmInterrupt(ALARM_2, false);
   
   //togliere il flag se si vuole  che al disabilitare EN venga subito disabilitato SWQ senza attendere SET 
    // RTC.squareWave(SQWAVE_NONE);

    
}


if(isInputDirty<input_SET>(ctx)){
       // set Alarm 2 for .....
    RTC.setAlarm(ALM2_MATCH_HOURS, 0, getValue<input_MIN>(ctx), getValue<input_HOUR>(ctx), 1);
    // clear the alarm flags
    RTC.alarm(ALARM_1);
    RTC.alarm(ALARM_2);
    // configure the INT/SQW pin for "interrupt" operation (disable square wave output)
    RTC.squareWave(SQWAVE_NONE);
    // enable interrupt output for Alarm 2 only
    RTC.alarmInterrupt(ALARM_1, false);
    RTC.alarmInterrupt(ALARM_2, getValue<input_EN>(ctx));
emitValue<output_DONE>(ctx, 1);

    }


}