rtc3231

dinosalvioni/ds3231/rtc3231

No description
rtc3231
@/rtc3231
SETpulse
update pusle
HOURnumber
MINnumber
rtc3231
SET
HOUR
MIN
DONE
DONEpulse
To use the node in your project you should have the dinosalvioni/ds3231 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);
    RTC.squareWave(SQWAVE_NONE);

 //   tmElements_t tm;
   // tm.Hour = 06;               // set the RTC time to 06:29:50
 //   tm.Minute = 29;
 //   tm.Second = 50;
 //   tm.Day = 16;
 //   tm.Month = 9;
 //   tm.Year = 2017 - 1970;      // tmElements_t.Year is the offset from 1970
   //RTC.write(tm);              // set the RTC from the tm structure

    
}


    if(isInputDirty<input_SET>(ctx)){
       // set Alarm 2 for 06:30:00
    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, true);
emitValue<output_DONE>(ctx, 1);

    }

}