potřeboval bych poradit se zápisem podmínky IF
Mám na Arduino Uno časový modul DS3231.
Vypisuji jednotlivě hodiny,minuty,sekundy na sériovou linku i display.
Potřebuji v čas 22:30:00 sepnout relé na pinu 8.
Už jsem vyzkoušel co mě napadlo i jsem googlil ale vypisuje mě to hlášku.
macro "min" requires 2 arguments, but only 1 given
Přikládám i kod za pomoc velmi děkuji.
Kód: Vybrat vše
#include <DS3231.h>
#include <LiquidCrystal.h>
// Init the DS3231 using the hardware interface
DS3231 rtc(SDA, SCL);
LiquidCrystal lcd(12, 11, 7, 6, 5, 4);
const int relayPin =8; //rele pin 8
// Init a Time-data structure
Time t;
void setup()
{
// Setup Serial connection
Serial.begin(115200);
// Uncomment the next line if you are using an Arduino Leonardo
//while (!Serial) {}
// Initialize the rtc object
rtc.begin();
// The following lines can be uncommented to set the date and time
//rtc.setDOW(WEDNESDAY); // Set Day-of-Week to SUNDAY
//rtc.setTime(12, 0, 0); // Set the time to 12:00:00 (24hr format)
//rtc.setDate(1, 1, 2014); // Set the date to January 1st, 2014
lcd.begin(16,2);
pinMode(relayPin, OUTPUT); //výstup relé
}
void loop()
{
// Get data from the DS3231
t = rtc.getTime();
// Send date over serial connection
Serial.print("Datum ");
Serial.print(t.date, DEC);
Serial.print(".");
Serial.print(t.mon, DEC);
Serial.print(".");
Serial.print(t.year, DEC);
Serial.print(" ");
// Send Day-of-Week and time
Serial.print("Cas ");
Serial.print(t.hour, DEC);
Serial.print(":");
Serial.print(t.min, DEC);
Serial.print(":");
Serial.print(t.sec, DEC);
Serial.println(" ");
lcd.setCursor(2,0);
lcd.print("Cas:");
lcd.print(t.hour, DEC);
lcd.print(":");
lcd.print(t.min, DEC);
lcd.print(":");
lcd.print(t.sec, DEC);
lcd.setCursor(0,1);
lcd.print("Datum:");
lcd.print(t.date, DEC);
lcd.print(".");
lcd.print(t.mon, DEC);
lcd.print(".");
lcd.print(t.year, DEC);
if (t.hour() == 21 && t.min() == 30 && t.sec() == 00)
{digitalWrite(relayPin, HIGH)} //Open the relay
// Wait one second before repeating :)
delay (1000);
}