- sziku69: Fűzzük össze a szavakat :)
- eBay-es kütyük kis pénzért
- Gurulunk, WAZE?!
- lezso6: Nem látszik a kurzor Chrome alatt a beviteli mezőkben?
- vrob: Az IBM PC és a játékok a 80-as években
- Luck Dragon: Asszociációs játék. :)
- sziku69: Szólánc.
- D1Rect: Nagy "hülyétkapokazapróktól" topik
- zebra_hun: Hűthető e kulturáltan a Raptor Lake léghűtővel a kánikulában?
- gban: Ingyen kellene, de tegnapra
-
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
ü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);
} -
Tomi8822
tag
Üdv, van egy ilyen kódom amit nem tudok működésre bírni, valaki tudja mi a probléma?
#include <RTClib.h>
#include <AutoSwitch.h>
#define WITH_DS3231
#include <AquaTimer.h>
RTC_DS3231 rtc;
const int LED_PIN = 6;
const int FILTER_PIN = 7;
// A világítás bekapcsoló gombja, egy óra után kikapcsolja magát
AutoSwitch LedButton(2, 3600);
// A szűrő stop etetéshez, ami 5 perc után újraindítja a szűrőt
AutoSwitch FilterStopButton(3, 300);
AquaTimer LedTimer;
AquaTimer Micro(8, "13:40:00", "13:40:04");
AquaTimer Macro(9, "13:40:20", "13:40:24");
AquaTimer Carbo(10, "13:40:40", "13:40:44");
AquaTimer Phosphate(11, "13:41:00", "13:41:04");
void setup() {
pinMode(FILTER_PIN, OUTPUT);
rtc.begin();
if (rtc.lostPower()) {
rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
}
// Világítás beállításai. A sok paraméter miatt metódus láncolással, hogy olvashatóbb legyen
// A LED dimmeléséhez a PWM kimenet miatt relé helyett itt egy MOSFET-re lesz szükség!
LedTimer
.setPin(LED_PIN)
.setOn("14:00") // bekapcs
.setTransition("30") // átmenet ideje percben
.setOff("22:00") // kikapcs
.setMoonDuration("60") // holfény derengés ideje percben, a kikapcs után
.setMaxVal("75%") // a teljes fényerő dimmeléséhez. Ha 100% kellene, akkor elhagyható
.setMoonVal(1); // a holfény fényereje. Itt szándékosan van int, a lehető legkisebb fényerő kedvéért
}
void loop() {
// Tápadagolók
Micro.write();
Macro.write();
Carbo.write();
Phosphate.write();
// Világítás a teljes fényerő gombbal
int buttonState = LedButton.getState();
LedTimer.write(buttonState);
// Szűrő stop - a relén a NC (Normally Closed) kimenetre érdemes kötni a szűrő konnektorát
int filterStopState = FilterStopButton.getState();
digitalWrite(FILTER_PIN, filterStopState);
} -
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
-
Tomi8822
tag
Üdv, valaki tudna segíteni nekem?
Ezt a programot szeretném használni de úgy hogy 6 db relét tudjak egyesével időre kapcsolni, lényegében 6 relére kéne kibővíteni. Eggyel működik gond nélkül.// 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;
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);
}
Új hozzászólás Aktív témák
Hirdetés
- Óra topik
- sziku69: Fűzzük össze a szavakat :)
- Amazfit Active 2 NFC - jó kör
- Metal topik
- Samsung Galaxy A54 - türelemjáték
- AMD K6-III, és minden ami RETRO - Oldschool tuning
- Érintésnélküli fizetési megoldások - PayPass via NFC
- Amlogic S905, S912 processzoros készülékek
- Kormányok / autós szimulátorok topikja
- Kazy Computers - Fehérvár - Megbízható?
- További aktív témák...
- DELL Universal Dock D6000 dokkolók, RTX Legion Pro laptopok 4 év Lenovo garanciával, licencek
- Apple iPhone 14 256GB/ 86% Akkuval / 12 hónap jótállással!
- Xbox Game Pass Ultimate kedvező áron, egyenesen a Microsoft-tól! - AUTOMATA BOLT
- BESZÁMÍTÁS! ASUS Z97-A Z97 chipset alaplap garanciával hibátlan működéssel
- ÁRGARANCIA!Épített KomPhone Ryzen 5 7600X 32/64GB RAM RX 7800 XT 16GB GAMER PC termékbeszámítással
Állásajánlatok
Cég: CAMERA-PRO Hungary Kft
Város: Budapest
Cég: PC Trade Systems Kft.
Város: Szeged