Well, here is the original code, which is working fine as is:
/*
#include <Time.h>
#include <TimeAlarms.h>
int solenoidPin = 13;
int releasePin = 10;
int buttonPin = 2;
int val = 0;
void setup()
{
Serial.begin(9600);
Serial.println("ANNIVERSARY ALARM - 7:50 3/23/2010 - STARTUP TIME = ");
Serial.println();
setTime(6,50,00,3,16,10); // set time to 6:50:00am March 16 2010
Alarm.alarmRepeat(7,00,00,EveningAlarm); // Seven Am
pinMode(buttonPin, INPUT);
}
void EveningAlarm()
{
Serial.println("Alarm: - Seven AM");
digitalWrite (solenoidPin, HIGH);
delay(3000);
digitalWrite (solenoidPin, LOW);
}
void loop()
{digitalClockDisplay();
Alarm.delay(1000); // wait one second between clock display
}
void digitalClockDisplay()
{
// digital clock display of the time
Serial.print(hour());
printDigits(minute());
printDigits(second());
Serial.println();
}
void printDigits(int digits)
{
// utility function for digital clock display: prints preceding colon and leading 0
Serial.print(":");
if(digits < 10)
Serial.print('0');
Serial.print(digits);
}
So, I suppose, how do I properly add this piece below, it's just to run separately to the actual alarm, in order to operate the 'release pin' when the buttons pressed...
{val = digitalRead(buttonPin);
digitalWrite(releasePin, val);
delay(120000);
digitalWrite(releasePin, LOW);
delay(100);
}