Hirdetés
- Azonnali informatikai kérdések órája
- TCL LCD és LED TV-k
- Melyik tápegységet vegyem?
- 3D nyomtatás
- A napi Windows-hiba? Teljes adatvesztés Bitlockerrel
- Ettől lesz más a tévézés? Teszten a OneTV SoundBox
- Gaming notebook topik
- Milyen asztali (teljes vagy fél-) gépet vegyek?
- Azonnali alaplapos kérdések órája
- Projektor topic
-
PROHARDVER!
Arduino hardverrel és szoftverrel foglakozó téma. Minden mikrovezérlő ami arduinoval programozható, és minden arduino program, board, és hardverrel kapcsolatos kérdések helye.
Új hozzászólás Aktív témák
-
Tomi8822
tag
üdv, segítenétek kijavítani a kódom, nem kapcsol rendesen, de nem találom a hibát.
beszúrom ide,ha tudnátok a hibát kijavítva beszúrnátok ti is, köszönom#include <Wire.h>
#include <RTClib.h>
#include <Time.h>
#include <TimeAlarms.h>
RTC_DS1307 RTC;
// Start Time Light 1
int sHour = 06;
int sMinute = 40;
int sSecond = 0;
// Start Time Light 2
int s2Hour = 07;
int s2Minute = 00;
int s2Second = 00;
// Start Time Light 3
int s3Hour = 07;
int s3Minute = 20;
int s3Second = 00;
// Start Time Light 4
int s4Hour = 07;
int s4Minute = 40;
int s4Second = 00;
// Start Time Light 5
int s5Hour = 07;
int s5Minute = 00;
int s5Second = 00;
// Start Time Light 6
int s6Hour = 07;
int s6Minute = 20;
int s6Second = 24;
// End Time Light 1
int eHour = 17;
int eMinute = 40;
int eSecond = 00;
// End Time Light 2
int e2Hour = 18;
int e2Minute = 00;
int e2Second = 00;
// End Time Light 3
int e3Hour = 18;
int e3Minute = 20;
int e3Second = 00;
// End Time Light 4
int e4Hour = 18;
int e4Minute = 40;
int e4Second = 00;
// End Time Light 5
int e5Hour = 19;
int e5Minute = 00;
int e5Second = 00;
// End Time Light 6
int e6Hour = 19;
int e6Minute = 20;
int e6Second = 00;
int lightRelay1 = 9;
int lightRelay2 = 2;
int lightRelay3 = 3;
int lightRelay4 = 4;
int lightRelay5 = 5;
int lightRelay6 = 6;
void setup() {
// Set the relay to off immediately
digitalWrite(lightRelay1, HIGH);
digitalWrite(lightRelay2, HIGH);
digitalWrite(lightRelay3, HIGH);
digitalWrite(lightRelay4, HIGH);
digitalWrite(lightRelay5, HIGH);
digitalWrite(lightRelay6, HIGH);
Serial.begin(9600);
Wire.begin();
RTC.begin();
// Set the pinmode
pinMode(lightRelay1, OUTPUT);
pinMode(lightRelay2, OUTPUT);
pinMode(lightRelay3, OUTPUT);
pinMode(lightRelay4, OUTPUT);
pinMode(lightRelay5, OUTPUT);
pinMode(lightRelay6, OUTPUT);
// Notify if the RTC isn't running
if (! RTC.isrunning()) {
Serial.println("RTC is NOT running");
}
// Get time from RTC
DateTime current = RTC.now();
DateTime compiled = DateTime(__DATE__, __TIME__);
if (current.unixtime() < compiled.unixtime()) {
Serial.println("RTC is older than compile time! Updating");
RTC.adjust(DateTime(__DATE__, __TIME__));
}
// Use RTC time to set the start time1
setTime(sHour, sMinute, sSecond, current.day(), current.month(), current.year());
time_t s = now();
// Use RTC time to set the start time2
setTime(s2Hour, s2Minute, s2Second, current.day(), current.month(), current.year());
time_t s2 = now();
// Use RTC time to set the start time3
setTime(s3Hour, s3Minute, s3Second, current.day(), current.month(), current.year());
time_t s3 = now();
// Use RTC time to set the start time4
setTime(s4Hour, s4Minute, s4Second, current.day(), current.month(), current.year());
time_t s4 = now();
// Use RTC time to set the start time5
setTime(s5Hour, s5Minute, s5Second, current.day(), current.month(), current.year());
time_t s5 = now();
// Use RTC time to set the start time6
setTime(s6Hour, s6Minute, s6Second, current.day(), current.month(), current.year());
time_t s6 = now();
// Use RTC time to set the end time1
setTime(eHour, eMinute, eSecond, current.day(), current.month(), current.year());
time_t e = now();
// Use RTC time to set the end time2
setTime(e2Hour, e2Minute, e2Second, current.day(), current.month(), current.year());
time_t e2 = now();
// Use RTC time to set the end time3
setTime(e3Hour, e3Minute, e3Second, current.day(), current.month(), current.year());
time_t e3 = now();
// Use RTC time to set the end time4
setTime(e4Hour, e4Minute, e4Second, current.day(), current.month(), current.year());
time_t e4 = now();
// Use RTC time to set the end time5
setTime(e5Hour, e5Minute, e5Second, current.day(), current.month(), current.year());
time_t e5 = now();
// Use RTC time to set the end time6
setTime(e6Hour, e6Minute, e6Second, current.day(), current.month(), current.year());
time_t e6 = now();
// Use RTC time to set the current time
setTime(current.hour(), current.minute(), current.second(), current.day(), current.month(), current.year());
time_t n = now();
// Test if grow light should be on
if (s <= n && n <= e) {
digitalWrite(lightRelay1, LOW); // Sets the grow light "on"
}
if (s2 <= n && n <= e2) {
digitalWrite(lightRelay2, LOW); // Sets the grow light "on"
}
if (s3 <= n && n <= e3) {
digitalWrite(lightRelay3, LOW); // Sets the grow light "on"
}
if (s4 <= n && n <= e4) {
digitalWrite(lightRelay4, LOW); // Sets the grow light "on"
}
if (s5 <= n && n <= e5) {
digitalWrite(lightRelay5, LOW); // Sets the grow light "on"
}
if (s6 <= n && n <= e6) {
digitalWrite(lightRelay6, LOW); // Sets the grow light "on"
}
Alarm.alarmRepeat(sHour, sMinute, sSecond, Light1On);
Alarm.alarmRepeat(eHour, eMinute, eSecond, Light1Off);
Alarm.alarmRepeat(s2Hour, s2Minute, s2Second, Light2On);
Alarm.alarmRepeat(e2Hour, e2Minute, e2Second, Light2Off);
Alarm.alarmRepeat(s3Hour, s3Minute, s3Second, Light3On);
Alarm.alarmRepeat(e3Hour, e3Minute, e3Second, Light3Off);
Alarm.alarmRepeat(s4Hour, s4Minute, s4Second, Light4On);
Alarm.alarmRepeat(e4Hour, e4Minute, e4Second, Light4Off);
Alarm.alarmRepeat(s5Hour, s5Minute, s5Second, Light5On);
Alarm.alarmRepeat(e5Hour, e5Minute, e5Second, Light5Off);
Alarm.alarmRepeat(s6Hour, s6Minute, s6Second, Light6On);
Alarm.alarmRepeat(e6Hour, e6Minute, e6Second, Light6Off);
}
void loop() {
DateTime now = RTC.now();
setTime(now.hour(), now.minute(), now.second(), now.day(), now.month(), now.year());
Serial.print("Current time: ");
Serial.print(now.year(), DEC);
Serial.print('/');
Serial.print(now.month(), DEC);
Serial.print('/');
Serial.print(now.day(), DEC);
Serial.print(' ');
Serial.print(now.hour(), DEC);
Serial.print(':');
Serial.print(now.minute(), DEC);
Serial.print(':');
Serial.print(now.second(), DEC);
Serial.println();
Serial.println();
Alarm.delay(600000);
}
void Light1On() {
Serial.println("Turning Light 1 On");
digitalWrite(lightRelay1, LOW);
}
void Light1Off() {
Serial.println("Turning Light 1 Off");
digitalWrite(lightRelay1, HIGH);
}
void Light2On() {
Serial.println("Turning Light 2 On");
digitalWrite(lightRelay2, LOW);
}
void Light2Off() {
Serial.println("Turning Light 2 Off");
digitalWrite(lightRelay2, HIGH);
}
void Light3On() {
Serial.println("Turning Light 3 On");
digitalWrite(lightRelay3, LOW);
}
void Light3Off() {
Serial.println("Turning Light 3 Off");
digitalWrite(lightRelay3, HIGH);
}
void Light4On() {
Serial.println("Turning Light 4 On");
digitalWrite(lightRelay4, LOW);
}
void Light4Off() {
Serial.println("Turning Light 4 Off");
digitalWrite(lightRelay4, HIGH);
}
void Light5On() {
Serial.println("Turning Light 5 On");
digitalWrite(lightRelay5, LOW);
}
void Light5Off() {
Serial.println("Turning Light 5 Off");
digitalWrite(lightRelay5, HIGH);
}
void Light6On() {
Serial.println("Turning Light 6 On");
digitalWrite(lightRelay6, LOW);
}
void Light6Off() {
Serial.println("Turning Light 6 Off");
digitalWrite(lightRelay6, HIGH);
}
Új hozzászólás Aktív témák
- Elektromos autók - motorok
- Elon Musk billiomos lesz, ha kitör a gépek forradalma
- Mesterséges intelligencia topik
- Autós topik
- RETRO beárazás (mobil, PC, konzol)
- Parfüm topik
- Azonnali informatikai kérdések órája
- Samsung Galaxy Z Fold7 - ezt vártuk, de…
- TCL LCD és LED TV-k
- World of Tanks - MMO
- További aktív témák...
- ASUS TUF Gaming A17 FA707RM - Ryzen 7 6800H, 17.3FULL HD 144Hz, 1.5TB, 16GB, Geforce RTX 3060 6GB
- Corsair RM850e 2025 850W 80+ Gold / ATX 3.1 / PCIe 5.1 - ~ÚJ - Alza garancia 2032.09.05.
- Bomba ár! HP Elitebook 8570P - i5-3340M I 8GB I 500GB HDD I DisplayPort I 15,6" HD I Garancia!
- Bomba ár! Lenovo ThinkBook 13s-IML - i5-10210U I 8GB I 256SSD I 13,3" FHD I Cam I W11 I Gari!
- Xiaomi Redmi Note 12 Pro 5G
- Dell Latitude 5290 i5 8350U, 8-16GB RAM, SSD, jó akku, EU bill., szép állapot, számla, 6 hó gar
- HP Omen 80G8E9 - 27" IPS - UHD 4K - 144Hz 1ms - NVIDIA G-Sync - FreeSync - HDR 400 - USB Type-C
- Készpénzes / Utalásos Videokártya és Hardver felvásárlás! Személyesen vagy Postával!
- Apple iPhone 17 Air 256,Új, Bontatlan,36 hónap garanciával
- ÁRGARANCIA!Épített KomPhone i5 13400F 16/32/64GB RAM RTX 3060 12GB GAMER PC termékbeszámítással
Állásajánlatok
Cég: Laptopműhely Bt.
Város: Budapest
Cég: NetGo.hu Kft.
Város: Gödöllő
ekkold

