-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathClockINO.ino
More file actions
92 lines (69 loc) · 2.14 KB
/
ClockINO.ino
File metadata and controls
92 lines (69 loc) · 2.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#define IR_USE_AVR_TIMER1
#include <IRremote.hpp>
#include <Wire.h>
#include "RTClib.h"
/*
Librarys:
https://github.com/Arduino-IRremote/Arduino-IRremote
https://www.arduino.cc/reference/en/libraries/rtclib-by-neiron/
*/
/*
Components:
Modul ceas: https://ardushop.ro/ro/home/959-modul-ceas-in-timp-real-pcf8563.html
Detector PIR de miscare: https://ardushop.ro/ro/electronica/45-modul-pir-senzor-de-prezenta-miscare.html
Senzor IR telecomanda: https://www.optimusdigital.ro/en/others/755-modul-receptor-telecomanda-infrarou.html
Buzzer: https://www.ardumotive.com/how-to-use-a-buzzer-en.html
Shift Registers: https://ardushop.ro/ro/electronica/141-ic-shift-register-sn74hc595n-74hc595.html
Transistor pentru bec: C9013
Display: ...
*/
#define YMD rtc.now().year(), rtc.now().month(), rtc.now().day()
#define ul unsigned long
template <typename T>
Print& operator<<(Print& printer, T value)
{
printer.print(value);
return printer;
}
bool readTime=false;
bool readAlarm=false;
int poz=0;
int digit1=9, digit2=9, digit3=9, digit4=9;
bool readSecs=false;
bool readHours=false;
bool readMinutes=false;
bool lightState=false;
int BR_CHG_RATE=100;
int RECV_PIN = 11;
int LIGHT_PIN=2;
int count=0;
bool ALARM_RUNNING=false;
int BUZZER_PIN=7;
PCF8563 rtc;
int PIR_PIN=6;
bool disabled=true; //true
bool IR_REMOTE=false; //false;
bool disabledSmall=true;
void setup() {
Serial.begin(9600);
Serial.println(F("\n------------------------------"));
Serial.println(F("ClockINO Kernel launched!"));
pinMode(LIGHT_PIN, OUTPUT);
initDisplay();
setDisplayBrightness(3000);
initIr();
//initBuzzer();
initPir();
initTime();
initClockINORegisters();
Serial<<F("[Alarm] Current time: ")<<rtc.now().year()<<F(" ")<<rtc.now().month()<<F(" ")<<rtc.now().day()<<F(" ")<<rtc.now().hour()<<F(" ")<<rtc.now().minute()<<F("\n");
Serial<<F("[Alarm] Alarm time: ")<<rtc.get_alarm().year()<<F(" ")<<rtc.get_alarm().month()<<F(" ")<<rtc.get_alarm().day()<<F(" ")<<rtc.get_alarm().hour()<<F(" ")<<rtc.get_alarm().minute()<<F("\n");
}
void loop() {
display();
checkPir();
checkIr();
disableTimeReading();
checkMemory();
alarm();
}