Hirdetés
- btz: Internet fejlesztés országosan!
- Sub-ZeRo: Euro Truck Simulator 2 & American Truck Simulator 1 (esetleg 2 majd, ha lesz) :)
- bambano: Bambanő háza tája
- urandom0: Száműztem az AI-t az életemből
- D1Rect: Nagy "hülyétkapokazapróktól" topik
- droidic: Safe Mode az agyban
- GoodSpeed: Munkaügyi helyzet Hajdú-Biharban: észak és dél
- Luck Dragon: Asszociációs játék. :)
- sziku69: Fűzzük össze a szavakat :)
- Invázió egy novellában 3-4. (Update) +5. fejezet! (18+ nyelvezet)
-
LOGOUT
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
// Date and time functions using a DS3231 RTC connected via I2C and Wire Lib
#include <Wire.h>
#include <RTClib.h>
#include <Time.h>
#include <TimeAlarms.h>
RTC_DS1307 RTC;
// Start Time
int sHour = 11;
int sMinute =30;
int sSecond = 0;
// End Time
int eHour = 11;
int eMinute = 30;
int eSecond = 4;
int lightRelay = 2;
int lightRelay2 = 3;
int lightRelay3 = 4;
int lightRelay4 = 5;
int lightRelay5 = 6;
int lightRelay6 = 7;
void setup() {
// Set the relay to off immediately
digitalWrite(lightRelay, HIGH);
Serial.begin(9600);
Wire.begin();
RTC.begin();
// Set the pinmode
pinMode(lightRelay, 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 time
setTime(sHour, sMinute, sSecond, current.day(), current.month(), current.year());
time_t s = now();
// Use RTC time to set the end time
setTime(eHour, eMinute, eSecond, current.day(), current.month(), current.year());
time_t e = 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(lightRelay, LOW); // Sets the grow light "on"
}
Alarm.alarmRepeat(sHour, sMinute, sSecond, LightOn);
Alarm.alarmRepeat(eHour, eMinute, eSecond, LightOff);
}
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(1000);
}
void LightOn() {
Serial.println("Turning Light On");
digitalWrite(lightRelay, LOW);
}
void LightOff() {
Serial.println("Turning Light Off");
digitalWrite(lightRelay, HIGH);
}Csak annyit szeretnék hogy a hat relét adott időben be majd ki kapcsolni külön külön
Új hozzászólás Aktív témák
- Revolut
- Nagyrobogósok baráti topikja
- Mesébe illő csodakábelt tervezett a GeForce-ok leégése ellen a Segotep?
- Milyen monitort vegyek?
- Milyen egeret válasszak?
- Kerékpárosok, bringások ide!
- Gitáros topic
- Milyen hagyományos (nem okos-) telefont vegyek?
- LEGO klub
- HiFi műszaki szemmel - sztereó hangrendszerek
- További aktív témák...
- Thinkpad T14 Gen1 27% 14" FHD IPS Ryzen 5 PRO 4650U 16GB 256GB NVMe SSD ,1 év garancia
- T14 Gen2 14" FHD IPS érintő Ryzen 5 PRO 5650U 16GB 512GB NVMe ujjlolv IR kam gar
- 0PERCES BOSE QuietComfort Ultra Headphones, zajszűrős, Bluetooth fejhallgató!
- GIGABYTE RTX 3080 10GB GDDR6X GAMING OC Eladó
- Thinkpad T14 Gen5 14" FHD+ IPS Ultra 7 155U 16GB 512GB NVMe ujjlolv IR kam gar
- 13-14" Új és használt laptopok , üzletitől a gamerig , kedvező áron. Garanciával !
- Azonnali készpénzes AMD Ryzen 1xxx 2xxx 3xxx 5xxx processzor felvásárlás személyesen / csomagküldés
- Lenovo Thinkpad X1 Yoga 6th Gen. i7 11th, 32GB RAM, új akku, 4G LTE, toll, 27% ÁFÁS (0215)
- Most èrkezett pár darab RX ès RTX 8gb vga-k! Számlás garanciás! Kamatmentes rèszletre is!
- HIBÁTLAN iPhone 13 mini 256GB Midnight -1 ÉV GARANCIA - Kártyafüggetlen, MS4078
Állásajánlatok
Cég: Laptopszaki Kft.
Város: Budapest
Cég: ATW Internet Kft.
Város: Budapest
ekkold
