I've finished the code, I think. I added pinmodes and changed the Serial.println's to digitalWrite. Now it even fits to this message:
#include <TimeLib.h>
#include <TimeAlarms.h>
AlarmId id;
int WHLON = 8; // Week hour for light on
int WMLON = 0; // Week minute for light on
int WHFON = 8; // Week hour for fan on
int WMFON = 0; // Week minute for fan on
int WHAON = 7; // Week hour for air on
int WMAON = 30; // Week minute for air on
int WHLOFF = 18; // Week hour for light off
int WMLOFF = 30; // Week minute for light off
int WHFOFF = 14; // Week hour for fan off
int WMFOFF = 50; // Week minute for fan off
int WHAOFF = 21; // Week hour for air off
int WMAOFF = 30; // Week minute for air off
int WEHLON = 8; // Weekend hour for light on
int WEMLON = 30; // Weekend minute for light on
int WEHFON = 8; // Weekend hour for fan on
int WEMFON = 0; // Weekend minute for fan on
int WEHAON = 8; // Weekend hour for air on
int WEMAON = 30; // Weekend minute for air on
int WEHLOFF = 18; // Weekend hour for light off
int WEMLOFF = 30; // Weekend minute for light off
int WEHFOFF = 8; // Weekend hour for fan off
int WEMFOFF = 0; // Weekend minute for fan off
int WEHAOFF = 22; // Weekend hour for air off
int WEMAOFF = 00; // Weekend minute for air off
//
//push-button
int buttonPin = 2; // the number of the input pin
int fanPin = 13; // the number of the output pin
int airPin = 12;
int lightPin = 11;
int state = HIGH; // the current state of the output pin
int reading; // the current reading from the input pin
int previous = LOW; // the previous reading from the input pin
// the follow variables are long's because the time, measured in miliseconds,
// will quickly become a bigger number than can be stored in an int.
long time = 0; // the last time the output pin was toggled
long debounce = 500; // the debounce time, increase if the output flickers
//END push-button
//
void setup() {
Serial.begin(9600);
while (!Serial) ; // wait for Arduino Serial Monitor
setTime(8, 29, 0, 1, 1, 16); // set time to Saturday 8:29:00am Jan 1 2016, comment this line out after first run
pinMode(buttonPin, INPUT); //push-button
pinMode(fanPin, OUTPUT);
pinMode(airPin, OUTPUT);
pinMode(lightPin, OUTPUT);
// create the alarms, to trigger at specific times
Alarm.alarmRepeat(dowMonday, WHLON, WMLON, 00, Mondaylighton);
Alarm.alarmRepeat(dowMonday, WHLOFF, WMLOFF, 00, Mondaylightoff);
Alarm.alarmRepeat(dowMonday, WHFON, WMFON, 00, Mondayfanon);
Alarm.alarmRepeat(dowMonday, WHFOFF, WMFOFF, 00, Mondayfanoff);
Alarm.alarmRepeat(dowMonday, WHAON, WMAON, 00, Mondayairon);
Alarm.alarmRepeat(dowMonday, WHAOFF, WMAOFF, 00, Mondayairoff);
Alarm.alarmRepeat(dowTuesday, WHLON, WMLON, 00, Tuesdaylighton);
Alarm.alarmRepeat(dowTuesday, WHLOFF, WMLOFF, 00, Tuesdaylightoff);
Alarm.alarmRepeat(dowTuesday, WHFON, WMFON, 00, Tuesdayfanon);
Alarm.alarmRepeat(dowTuesday, WHFOFF, WMFOFF, 00, Tuesdayfanoff);
Alarm.alarmRepeat(dowTuesday, WHAON, WMAON, 00, Tuesdayairon);
Alarm.alarmRepeat(dowTuesday, WHAOFF, WMAOFF, 00, Tuesdayairoff);
Alarm.alarmRepeat(dowWednesday, WHLON, WMLON, 00, Wednesdaylighton);
Alarm.alarmRepeat(dowWednesday, WHLOFF, WMLOFF, 00, Wednesdaylightoff);
Alarm.alarmRepeat(dowWednesday, WHFON, WMFON, 00, Wednesdayfanon);
Alarm.alarmRepeat(dowWednesday, WHFOFF, WMFOFF, 00, Wednesdayfanoff);
Alarm.alarmRepeat(dowWednesday, WHAON, WMAON, 00, Wednesdayairon);
Alarm.alarmRepeat(dowWednesday, WHAOFF, WMAOFF, 00, Wednesdayairoff);
Alarm.alarmRepeat(dowThursday, WHLON, WMLON, 00, Thursdaylighton);
Alarm.alarmRepeat(dowThursday, WHLOFF, WMLOFF, 00, Thursdaylightoff);
Alarm.alarmRepeat(dowThursday, WHFON, WMFON, 00, Thursdayfanon);
Alarm.alarmRepeat(dowThursday, WHFOFF, WMFOFF, 00, Thursdayfanoff);
Alarm.alarmRepeat(dowThursday, WHAON, WMAON, 00, Thursdayairon);
Alarm.alarmRepeat(dowThursday, WHAOFF, WMAOFF, 00, Thursdayairoff);
Alarm.alarmRepeat(dowFriday, WHLON, WMLON, 00, Fridaylighton);
Alarm.alarmRepeat(dowFriday, WHLOFF, WMLOFF, 00, Fridaylightoff);
Alarm.alarmRepeat(dowFriday, WHFON, WMFON, 00, Fridayfanon);
Alarm.alarmRepeat(dowFriday, WHFOFF, WMFOFF, 00, Fridayfanoff);
Alarm.alarmRepeat(dowFriday, WHAON, WMAON, 00, Fridayairon);
Alarm.alarmRepeat(dowFriday, WHAOFF, WMAOFF, 00, Fridayairoff);
Alarm.alarmRepeat(dowSaturday, WEHLON, WEMLON, 00, Saturdaylighton);
Alarm.alarmRepeat(dowSaturday, WEHLOFF, WEMLOFF, 00, Saturdaylightoff);
// Alarm.alarmRepeat(dowSaturday,WEHFON,WEMFON,00,Saturdayfanon);
// Alarm.alarmRepeat(dowSaturday,WEHFOFF,WEMFOFF,00,Saturdayfanoff);
Alarm.alarmRepeat(dowSaturday, WEHAON, WEMAON, 00, Saturdayairon);
Alarm.alarmRepeat(dowSaturday, WEHAOFF, WEMAOFF, 00, Saturdayairoff);
Alarm.alarmRepeat(dowSunday, WEHLON, WEMLON, 00, Sundaylighton);
Alarm.alarmRepeat(dowSunday, WEHLOFF, WEMLOFF, 00, Sundaylightoff);
// Alarm.alarmRepeat(dowSunday,WEHFON,WEMFON,00,Sundayfanon);
// Alarm.alarmRepeat(dowSunday,WEHFOFF,WEMFOFF,00,Sundayfanoff);
Alarm.alarmRepeat(dowSunday, WEHAON, WEMAON, 00, Sundayairon);
Alarm.alarmRepeat(dowSunday, WEHAOFF, WEMAOFF, 00, Sundayairoff);
}
void loop() {
digitalClockDisplay();
Alarm.delay(0);
//
//Push-button as a switch for switching the fan manually on/off
reading = digitalRead(buttonPin);
// if the input just went from LOW and HIGH and we've waited long enough
// to ignore any noise on the circuit, toggle the output pin and remember
// the time
if (reading == HIGH && previous == LOW && millis() - time > debounce) {
if (state == HIGH)
state = LOW;
else
state = HIGH;
time = millis();
}
digitalWrite(fanPin, state);
previous = reading;
//END push-button
//
}
// functions to be called when an alarm triggers:
void Mondaylighton() {
digitalWrite(lightPin, HIGH);
}
void Mondaylightoff() {
digitalWrite(lightPin, LOW);
}
void Mondayfanon() {
digitalWrite(fanPin, HIGH);
}
void Mondayfanoff() {
digitalWrite(fanPin, LOW);
}
void Mondayairon() {
digitalWrite(airPin, HIGH);
}
void Mondayairoff() {
digitalWrite(airPin, LOW);
}
void Tuesdaylighton() {
digitalWrite(lightPin, HIGH);
}
void Tuesdaylightoff() {
digitalWrite(lightPin, LOW);
}
void Tuesdayfanon() {
digitalWrite(fanPin, HIGH);
}
void Tuesdayfanoff() {
digitalWrite(fanPin, LOW);
}
void Tuesdayairon() {
digitalWrite(airPin, HIGH);
}
void Tuesdayairoff() {
digitalWrite(airPin, LOW);
}
void Wednesdaylighton() {
digitalWrite(lightPin, HIGH);
}
void Wednesdaylightoff() {
digitalWrite(lightPin, LOW);
}
void Wednesdayfanon() {
digitalWrite(fanPin, HIGH);
}
void Wednesdayfanoff() {
digitalWrite(fanPin, LOW);
}
void Wednesdayairon() {
digitalWrite(airPin, HIGH);
}
void Wednesdayairoff() {
digitalWrite(airPin, LOW);
}
void Thursdaylighton() {
digitalWrite(lightPin, HIGH);
}
void Thursdaylightoff() {
digitalWrite(lightPin, LOW);
}
void Thursdayfanon() {
digitalWrite(fanPin, HIGH);
}
void Thursdayfanoff() {
digitalWrite(fanPin, LOW);
}
void Thursdayairon() {
digitalWrite(airPin, HIGH);
}
void Thursdayairoff() {
digitalWrite(airPin, LOW);
}
void Fridaylighton() {
digitalWrite(lightPin, HIGH);
}
void Fridaylightoff() {
digitalWrite(lightPin, LOW);
}
void Fridayfanon() {
digitalWrite(fanPin, HIGH);
}
void Fridayfanoff() {
digitalWrite(fanPin, LOW);
}
void Fridayairon() {
digitalWrite(airPin, HIGH);
}
void Fridayairoff() {
digitalWrite(airPin, LOW);
}
void Saturdaylighton() {
digitalWrite(lightPin, HIGH);
}
void Saturdaylightoff() {
digitalWrite(lightPin, LOW);
}
void Saturdayfanon() {
digitalWrite(fanPin, HIGH);
}
void Saturdayfanoff() {
digitalWrite(fanPin, LOW);
}
void Saturdayairon() {
digitalWrite(airPin, HIGH);
}
void Saturdayairoff() {
digitalWrite(airPin, LOW);
}
void Sundaylighton() {
digitalWrite(lightPin, HIGH);
}
void Sundaylightoff() {
digitalWrite(lightPin, LOW);
}
void Sundayfanon() {
digitalWrite(fanPin, HIGH);
}
void Sundayfanoff() {
digitalWrite(fanPin, LOW);
}
void Sundayairon() {
digitalWrite(airPin, HIGH);
}
void Sundayairoff() {
digitalWrite(airPin, LOW);
}
void digitalClockDisplay() {
// digital clock display of the time
Serial.print(hour());
printDigits(minute());
printDigits(second());
Serial.println();
}
void printDigits(int digits) {
Serial.print(":");
if (digits < 10)
Serial.print('0');
Serial.print(digits);
}