Keresés

Hirdetés

Új hozzászólás Aktív témák

  • lajbi30

    csendes tag

    Egy Arduino szakértöt keresek,aki honorárium ellenében,megírna egy programot.

  • lajbi30

    csendes tag

    válasz dave0825 #1262 üzenetére

    //Sample using LiquidCrystal library
    #include <LiquidCrystal.h>

    /*******************************************************

    This program will test the LCD panel and the buttons of
    the DFRobot LCD Keypad Shield for Arduino
    Product code : RB-Dfr-07
    http://www.robotshop.com/dfrobot-lcd-keypad-shield-arduino-1.html

    Note cct error identified by Arduino forum discussion at:
    http://arduino.cc/forum/index.php/topic,96747.0.html
    which advises insertion of a Germanium 1n34a or a Schotky 1N5819
    diode between pin 10 and the base of Q1 (K to pin 10).

    sample code originally by Mark Bramwell, July 2010
    modifications by Dion Weston, March 2012

    ********************************************************/

    // select the pins used on the LCD panel
    LiquidCrystal lcd(8, 9, 4, 5, 6, 7);

    // define some values used by the panel and buttons
    int backLight = 10; // LCD Panel Backlight LED connected to digital pin 10
    int lightLevel = 255; // Initialise light full on
    int lcd_key = 0;
    int adc_key_in = 0;
    #define btnRIGHT 0
    #define btnUP 1
    #define btnDOWN 2
    #define btnLEFT 3
    #define btnSELECT 4
    #define btnNONE 5

    // read the buttons
    int read_LCD_buttons()
    {
    adc_key_in = analogRead(0); // read the value from the sensor
    // my [Mark Bramwell's] buttons when read are centered at these valies: 0, 144, 329, 504, 741
    // we add approx 50 to those values and check to see if we are close
    if (adc_key_in > 1000) return btnNONE; // We make this the 1st option for speed reasons since it will be the most likely result
    if (adc_key_in < 50) return btnRIGHT;
    if (adc_key_in < 195) return btnUP;
    if (adc_key_in < 380) return btnDOWN;
    if (adc_key_in < 555) return btnLEFT;
    if (adc_key_in < 790) return btnSELECT;
    return btnNONE; // when all others fail, return this...
    }

    void setup()
    {
    lcd.begin(16, 2); // start the LCD library
    lcd.setCursor(0,0); // move cursor to beginning of line "0"
    lcd.print("Backlight adjust"); // print a simple message

    }

    void loop()
    {
    analogWrite(backLight, lightLevel);
    lcd.setCursor(13,1); // move to position 13 on the second line
    lcd.print(lightLevel);

    lcd.setCursor(0,1); // move to the begining of the second line
    lcd_key = read_LCD_buttons(); // read the buttons

    switch (lcd_key) // depending on which button was pushed, we perform an action
    {
    case btnRIGHT:
    {
    lcd.print("LED On ");
    lightLevel = 255;
    break;
    }
    case btnLEFT:
    {
    lcd.print("LED Off ");
    lightLevel = 1;
    break;
    }
    case btnUP:
    {
    lcd.print("LED Fade Up ");
    if (lightLevel < 255) lightLevel += 1;
    break;
    }
    case btnDOWN:
    {
    lcd.print("LED Fade Down ");
    if (lightLevel > 1) lightLevel -= 1;
    break;
    }
    case btnSELECT:
    {
    lcd.print("Select ");
    break;
    }
    case btnNONE:
    {
    lcd.print(" ");
    break;
    }
    }

    }

    Kilyelző fényerejének változtatása

    [ Szerkesztve ]

  • lajbi30

    csendes tag

    válasz dave0825 #1272 üzenetére

    Akvárium vezérlés lenne és kicsit összetettebb:)
    Ha érdekel, add meg a telszámod. Elmondom miről lenne szó. Mondasz egy árat és megegyezünk.

  • lajbi30

    csendes tag

    válasz gyapo11 #1277 üzenetére

    Írogathatnék,hogy S.O.S. valaki. De az sok idő lenne,mire így összeállna a terv. Egyszerübb valakinek fizetni érte. Végig olvastam majdnem az egész fórumot és bizony vannak itt nagy fejek akiknek gyerekjáték lenne megcsinálni azt amit én szeretnék. Nem is a kapcsolásokkal van a baj,hanem a programmal. Érdekel a dolog,de nagyom mélyre kellene visszamennem,amire nincs időm,sem energiám.SAJNOS!

  • lajbi30

    csendes tag

    válasz lajbi30 #1278 üzenetére

    Ha később még eszembe jutna,hogy ez is meg az is kellene bele,akkor az sem ingyen kell!
    Működjön!!!!

  • lajbi30

    csendes tag

    válasz gyapo11 #1280 üzenetére

    Én sem dolgozok ingyen. Más ha csak el kell magyarázni egy 1-2 apróságot. Azért én sem kérek pénzt. De nekem kell megcsinálni mindent,akkor azért pénzt kérek. Ezért nem várom el ingyen én sem. Van 1-2 dolog amit 3nap után sikerült megcsinálnom,de nem tudom összekombinálni azt pár valamit amire nekem szükségem lenne.

    [ Szerkesztve ]

  • lajbi30

    csendes tag

    válasz gyapo11 #1282 üzenetére

    Akvárium vezérlést szeretnék!
    Inkább világitás. T5+LED+ventilátor kapcsolása bizonyos hőmérsékleten.
    Mind ezt LCD-ről vezérelve. Automatikus és manuális fényerő szabályozás a ledeknél. Valami ilyesmi. Idő és dátum kijelzéssel.

  • lajbi30

    csendes tag

    válasz gyapo11 #1285 üzenetére

    LCD-n menü nyomógombokkal. A ledeket dimmelni szeretném. PL:8:00-kor bekapcsol és fokozatosan éri el a 100%-ot. T5 fénycsövek. Ezeket csak ki-be kell kapcsólgatni. PL: 1 cső 9:00, 2 cső 9:30, 3 cső 10:00

    [ Szerkesztve ]

  • lajbi30

    csendes tag

    válasz softguner #1287 üzenetére

    Akváriumhoz a leggagyibb a led szalag. 1w-os power ledekről van szó áramgenerátorral. Elvileg a feszültséget
    kell csak szabályozni ahoz,hogy a fényerőt csökkentsük vagy növeljük. De ezt autómatikusan kéne,hogy csinálja. RTC-m is van. A távirányitás felesleges,ha automatán csinál mindent. A ventilátornak 26 fokon bekapcsólni és lekapcsólni.

    [ Szerkesztve ]

  • lajbi30

    csendes tag

    válasz gyapo11 #1291 üzenetére

    Ezért kértem az s.o.s-t itt a fórumon,mert nem értek hozzá. Érdekel,de nem értem.

    [ Szerkesztve ]

  • lajbi30

    csendes tag

    válasz Gergosz2 #1293 üzenetére

    OK! 26 fokon bekapcsól a venti,25 fokon ki. Ez is jó! De ez már részlet kérdés.

  • lajbi30

    csendes tag

    válasz Gergosz2 #1297 üzenetére

    Venti-vel vagy kimondott akvárium klímával hűtik. A klíma használtan is van vagy 30-k. Amúgy meg tényleg a víz hőmérséklet szabályozás lenne a lényeg. De ez is részlet kérdés. A programnak kéne így működnie.

    [ Szerkesztve ]

  • lajbi30

    csendes tag

    válasz Gergosz2 #1301 üzenetére

    Egy jelenleg is működő akváriumról tárgyalunk. Minden működik amiről beszélgetünk csak manuálisan. A világitás és a venti 220-as időkapcsolókkal és a led nem dimmelt. Ezeket szeretném automatizálni.

    [ Szerkesztve ]

  • lajbi30

    csendes tag

    válasz Gergosz2 #1303 üzenetére

    ne adjátok fel fiuk!
    Nekem csak egy program kéne a többit én már megoldom.

  • lajbi30

    csendes tag

    válasz Gergosz2 #1307 üzenetére

    Még mindig áll az ajánlatom!
    Mellékelem az elképzelésem

  • lajbi30

    csendes tag

    válasz lajbi30 #1308 üzenetére

    No itt egy működő óra!

    // simple sketch to display a digital Alarm clock on an LCD keypad shield without RTC
    // see the LiquidCrystal documentation for more info on this
    //

    /*
    The circuit:
    * LCD RS (Data or Signal Display Selection) pin to digital pin 8
    * LCD Enable pin to digital pin 9
    * LCD D4 pin to digital pin 4
    * LCD D5 pin to digital pin 5
    * LCD D6 pin to digital pin 6
    * LCD D7 pin to digital pin 7
    * LCD R/W pin to ground
    * 10K resistor:
    * ends to +5V and ground
    * wiper to LCD VO pin (pin 3)
    * Backlit Control to Digital 10
    * Button (select, up, right, down and left) to Analog 0
    */

    #include <LiquidCrystal.h>
    // include header file for time function
    #include <Time.h>
    /*
    You can download the library from here:

    https://github.com/JChristensen/Timer
    */

    // Button defination for LCD Keypad shield
    #define btnRIGHT 0 // Okay
    #define btnUP 1 // inc
    #define btnDOWN 2 // dec
    #define btnLEFT 3 // Select
    #define btnSELECT 4 // Menu
    #define btnNONE 5
    // Observed values:
    // NONE: 1023
    // SELECT: 723
    // LEFT: 481
    // DOWN: 307
    // UP: 133
    // RIGHT: 0

    #define beeper A1 // Alarm buzzer
    #define shortBeep 100
    #define longBeep 500

    #define TIME_MSG_LEN 11 // time sync to PC is HEADER followed by unix time_t as ten ascii digits
    #define TIME_HEADER 'T' // Header tag for serial time sync message
    #define TIME_REQUEST 7 // ASCII bell character requests a time sync message

    // define variables
    int lcd_key = 0;
    int adc_key_in = 0;
    int lastDay = 0;
    int lastMonth = 0;
    int lastYear = 0;
    int lastHour = 0;
    int lastMinute = 0;
    int movementTimer = 0;
    int menuOptions = 4;
    int menuOption = 0;
    int alarmHours = 0;
    int alarmMinutes = 0;
    bool alarmSet = 0;
    bool backLightOn = 1;
    int fadeValue = 255;

    // define constants
    const int backLight = 10; // pin 10 will control the LCD backlight

    LiquidCrystal lcd(8, 9, 4, 5, 6, 7);

    void setup()
    {
    pinMode(backLight, OUTPUT);
    pinMode(beeper, OUTPUT);
    digitalWrite(backLight, HIGH); // turn backlight on. Replace 'HIGH' with 'LOW' to turn it off.
    Serial.begin(9600);
    setSyncProvider( requestSync); //set function to call when sync required
    }

    void loop(){
    if(Serial.available() )
    {
    processSyncMessage();
    }
    else
    if(timeStatus()== timeNotSet)
    {
    // setTime(1356210000);
    setTime(8, 0, 0, 20, 1, 2013); // hour, min, sec, day, month, year
    // Replace this with the most current time
    }

    if(timeStatus()!= timeNotSet)
    {
    digitalWrite(13,timeStatus() == timeSet); // on if synced, off if needs refresh
    digitalClockDisplay();
    }

    for (int i = 0; i < 9000; i++)
    {
    button_loop(); //check for button pushed
    }
    }

    void printDigits(byte digits){
    // utility function for digital clock display: prints preceding colon and leading 0
    lcd.print(":");
    if(digits < 10)
    lcd.print('0');
    lcd.print(digits,DEC);
    }

    void digitalClockDisplay(){
    //lcd.clear();
    lcd.begin(16,2);
    lcd.setCursor(3,0);
    lcd.print(" ");
    lcd.setCursor(3,1);
    lcd.print(" ");
    lcd.setCursor(3,0);
    if(day() <10)
    lcd.print('0');
    lcd.print(day(),DEC);
    lcd.print("/");

    if(month() <10)
    lcd.print('0');
    lcd.print(month(),DEC);
    lcd.print("/");
    lcd.print((year()));

    //lcd.print(" ");
    if(hour() <10)
    lcd.setCursor(5,1);
    lcd.setCursor(4,1);

    // digital clock display of current time
    lcd.print(hour(),DEC);
    printDigits(minute());
    printDigits(second());
    // for time set
    lastDay = day();
    lastMonth = month();
    lastYear = year();
    lastHour = hour();
    lastMinute = minute();

    //check for alarm
    if (alarmSet)
    {
    // alarm set
    if (alarmHours == lastHour && alarmMinutes == lastMinute)
    {
    //sound alarm
    setOffAlarm();
    }
    }
    }

    void processSyncMessage() {
    // if time sync available from serial port, update time and return true
    while(Serial.available() >= TIME_MSG_LEN ){ // time message consists of a header and ten ascii digits
    char c = Serial.read() ;
    Serial.print(c);
    if( c == TIME_HEADER ) {
    time_t pctime = 0;
    for(int i=0; i < TIME_MSG_LEN -1; i++){
    c = Serial.read();
    if( c >= '0' && c <= '9'){
    pctime = (10 * pctime) + (c - '0') ; // convert digits to a number
    }
    }
    setTime(pctime); // Sync Arduino clock to the time received on the serial port
    }
    }
    }

    time_t requestSync()
    {
    Serial.write(TIME_REQUEST);
    return 0; // the time will be sent later in response to serial mesg
    }

    void button_loop()
    {
    int button = read_LCD_buttons();
    if (button == btnSELECT)
    {
    timedBeep(shortBeep,1);
    selectMenu();
    }
    if (button == btnDOWN)
    {
    fadeValue = fadeValue -5;
    if (fadeValue < 5) { fadeValue = 0; }
    analogWrite (backLight, fadeValue);
    delay (100);
    }
    if (button == btnUP)
    {
    fadeValue = fadeValue +5;
    if (fadeValue > 254) { fadeValue = 255; }
    analogWrite (backLight, fadeValue);
    delay (100);
    }
    }

    void selectMenu()
    {
    int button = 0;
    menuOption = 1;
    lcdClear();
    lcd.print("Minute Timer");

    while (menuOption <= menuOptions)
    {
    button = read_LCD_buttons();
    if (button == btnSELECT)
    {
    timedBeep(shortBeep,1);
    menuOption++;

    if (menuOption == 2)
    {
    lcdClear();
    // clearAlarm feature
    lcd.print("Set/Clear Alarm");
    }
    if (menuOption == 3)
    {
    lcdClear();
    lcd.print("Set Date/Time");
    }
    if (menuOption == 4)
    {
    lcdClear();
    lcd.print("Stop Watch Timer");
    }
    }

    if (button == btnLEFT)
    {
    if (menuOption == 1)
    {
    timedBeep(shortBeep,1);
    minuteTimer();
    return;
    }
    if (menuOption == 2)
    {
    timedBeep(shortBeep,1);
    // clearAlarm feature
    //check for existing alarm
    if (alarmSet)
    {
    clearAlarm();
    }
    else
    {
    setAlarm();
    }
    return;
    }
    if (menuOption == 3)
    {
    timedBeep(shortBeep,1);
    // setDateTime feature
    setDateTime();
    return;
    }
    if (menuOption == 4)
    {
    timedBeep(shortBeep,1);
    stopwatch_time_counter();
    return;
    }
    }
    }
    }

    // clearAlarm feature
    void clearAlarm()
    {
    int button = 0;
    bool clearIt = true;

    lcdClear();
    lcd.print("Alarm Set For");
    lcd.setCursor(0,1);
    lcd.print(alarmHours);
    lcd.print(":");
    lcd.print(alarmMinutes);
    delay(2000);
    lcdClear();
    lcd.print("Clear Alarm?");
    lcd.setCursor(0,1);
    lcd.print("Yes");

    while (button != btnSELECT)
    {
    button = read_LCD_buttons();
    if (button == btnUP)
    {
    timedBeep(shortBeep,1);
    clearIt = !clearIt;
    }
    if (button == btnDOWN)
    {
    timedBeep(shortBeep,1);
    clearIt = !clearIt;
    }
    if (button == btnRIGHT)
    {
    timedBeep(shortBeep,1);
    alarmSet = !clearIt;
    if (clearIt)
    {
    lcdClear();
    timedBeep(shortBeep,2);
    lcd.print("Alarm Cleared!");
    delay(2000);
    }
    return;
    }
    lcd.setCursor(0,1);
    if (clearIt)
    {
    lcd.print("Yes");
    }
    else{
    lcd.print("No ");
    }
    }
    }

    void minuteTimer()
    {
    // Pass maxCount to getTimerMinutes
    int timerMinutes = getTimerMinutes("Set Minutes", 0, 60);
    if (timerMinutes > 0)
    {
    timedCountDown(timerMinutes*60, "Minute Timer");
    }
    else
    {
    timerCancelled("Timer");
    }
    return;
    }

    void stopwatch_time_counter()
    {
    static unsigned long elapsed_time = 0;
    static unsigned long last_read;
    static unsigned char is_ticking = 0;
    static unsigned char top_is_pressed = 0;
    static unsigned char bottom_is_pressed = 0;
    static unsigned char last_seconds = 0;
    int button = 0;

    while (button != btnSELECT)
    {

    unsigned long current_time = millis();
    if(is_ticking)
    {
    elapsed_time += current_time - last_read;
    }
    last_read = current_time;

    button = read_LCD_buttons();
    if(button == btnUP)
    {
    if(!top_is_pressed)
    {
    // reset
    top_is_pressed = 1;
    is_ticking = 0;
    elapsed_time = 0;
    timedBeep(shortBeep,1);

    //wait_for_button_release(TOP_BUTTON);clear();// tmphax to make this work on org06a01
    lcdClear();
    lcd.print("Stop Watch Timer");
    }
    }
    else
    {
    top_is_pressed = 0;
    }

    if(button == btnDOWN)
    {
    if(!bottom_is_pressed)
    {
    // start/stop
    bottom_is_pressed = 1;
    is_ticking = !is_ticking;
    timedBeep(shortBeep,1);
    }
    }
    else
    {
    bottom_is_pressed = 0;
    }

    lcd.setCursor(0,1);
    lcd.print(elapsed_time/1000/60/60/10%10); // tens of hours
    lcd.print(elapsed_time/1000/60/60%10); // hours
    lcd.print(":");
    lcd.print(elapsed_time/1000/60/10%10%6); // tens of minutes
    lcd.print(elapsed_time/1000/60%10); // minutes
    lcd.print(":");
    lcd.print(elapsed_time/1000%60/10); // tens of seconds
    unsigned char seconds = elapsed_time/1000%60%10;
    lcd.print(seconds);
    lcd.print(".");
    lcd.print(elapsed_time/100%10); // tenths of seconds
    lcd.print(elapsed_time/10%10); // hundredths of seconds

    // beep every second
    if(seconds != last_seconds && elapsed_time != 0)
    {
    //timedBeep(shortBeep,1);
    }
    last_seconds = seconds;
    }

    timerCancelled("StopWatch");

    }

    void setAlarm()
    {
    int button = 0;
    // Pass maxCount to getTimerMinutes
    alarmHours = getTimerMinutes("Set Alarm Hour", alarmHours, 23);
    // Validate alarm hours > 0 and < 24
    if (alarmHours >= 0 && alarmHours < 24)
    {
    // Pass maxCount to getTimerMinutes
    alarmMinutes = getTimerMinutes("Set Minutes", alarmMinutes, 59);
    // allow alarm minutes to be 0
    if (alarmMinutes < 60)
    {
    lcdClear();
    lcd.setCursor(0,1);
    //display alarm time
    lcd.print(alarmHours);
    lcd.print(":");
    if (alarmMinutes < 10)
    lcd.print("0");
    lcd.print(alarmMinutes);
    if (button == btnRIGHT)
    {
    timedBeep(shortBeep,1);
    alarmSet = true;
    lcd.setCursor(0,0);
    lcd.print("Alarm Set for");
    delay(1000);
    return;
    }
    else
    {
    timerCancelled("Alarm");
    return;
    }
    }
    else
    {
    timerCancelled("Alarm");
    }
    }
    else
    {
    timerCancelled("Alarm");
    }
    }

    // setDateTime feature
    void setDateTime()
    {
    int button = 0;

    //get month
    int setMonth = getTimerMinutes("Set Month", lastMonth, 12);
    if (setMonth > 0 && setMonth < 13)
    {
    //get day
    // default day and hour settings on set date/time
    int setDay = getTimerMinutes("Set Day", lastDay, 31);
    if (setDay > 0 && setDay < 32)
    {
    //get year
    int setYear = getTimerMinutes("Set Year", lastYear, 2999);
    if (setYear > 2000 && setYear < 3000)
    {
    //get hour
    int thisHour = lastHour;
    // default day and hour settings on set date/time
    int setHour = getTimerMinutes("Set Hour", thisHour, 23);
    if (setHour >= 0 && setHour < 24)
    {
    //get minutes
    int setMinute = getTimerMinutes("Set Minute", lastMinute, 59);
    if (setMinute < 60)
    {
    // RTC.adjust(DateTime(setYear,setMonth,setDay,setHour,setMinute)); // for DS1307
    setTime(setHour, setMinute, 0, setDay, setMonth, setYear); // sec, min, hour, date, month, year

    lcd.setCursor(0,0);
    lcd.print("Saving... ");
    delay(1000);
    return;
    }
    else
    {
    timerCancelled("");
    return;
    }
    }
    else
    {
    timerCancelled("");
    }
    }
    else
    {
    timerCancelled("");
    }
    }
    else
    {
    timerCancelled("");
    }
    }
    else
    {
    timerCancelled("");
    }

    }

    // read the buttons from LCD keypad shield
    int read_LCD_buttons()
    {
    adc_key_in = analogRead(0); // read the value from the sensor
    // my buttons when read are centered at these valies: 0, 131, 307, 481, 722
    // we add approx 50 to those values and check to see if we are close
    // No button pressed should be 1023
    if (adc_key_in > 1000) return btnNONE; // We make this the 1st option for speed reasons since it will be the most likely result
    if (adc_key_in < 50) return btnRIGHT;
    if (adc_key_in < 195) return btnUP;
    if (adc_key_in < 380) return btnDOWN;
    if (adc_key_in < 555) return btnLEFT;
    if (adc_key_in < 790) return btnSELECT;
    return btnNONE; // when all others fail, return this...

    }

    void timedCountDown(int secondCount, char countLabel[])
    {
    long seconds = 0;
    long minutes = 0;

    lcdClear();
    lcd.print(countLabel);
    for (int i = secondCount; i >= 0; i--)
    {
    seconds = i;
    minutes = i / 60;
    if (minutes > 0)
    {
    seconds = seconds - (minutes * 60);
    }

    if (minutes > 0)
    {
    lcd.setCursor(0,1);
    lcd.print(minutes);
    lcd.print(" min ");
    }
    else
    {
    lcd.setCursor(0,1);
    }
    if (seconds < 10) lcd.print("0");
    lcd.print(seconds);
    lcd.print(" sec remaining");
    if (seconds > 0) delay(1000);
    if (read_LCD_buttons() == btnSELECT) //cancel
    {
    timerCancelled("Timer");
    i = 0;
    return;
    }
    }
    lcd.setCursor(6,1);
    timedBeep(longBeep,3);
    }

    // Pass maxCount to getTimerMinutes
    int getTimerMinutes(char timerText[], int startNum, int maxCount)
    {
    int minutes = startNum;
    int button = 0;
    lcdClear();
    lcd.print(timerText);
    lcd.setCursor(0,1);
    lcd.print(minutes);

    while (button != btnSELECT)
    {
    button = read_LCD_buttons();
    Serial.println(button);

    if (button == btnLEFT)
    {
    if ((minutes + 10) <= maxCount)
    {
    timedBeep(shortBeep,1);
    minutes = minutes + 10;
    }
    else
    {
    timedBeep(shortBeep,2);
    }
    }

    if (button == btnUP)
    {
    if (minutes < maxCount)
    {
    timedBeep(shortBeep,1);
    minutes++;
    }
    else
    {
    timedBeep(shortBeep,2);
    minutes = 0;
    }
    }
    if (button == btnDOWN)
    {
    if (minutes > 0)
    {
    timedBeep(shortBeep,1);
    minutes--;
    }
    else
    {
    timedBeep(shortBeep,2);
    minutes = maxCount;
    }
    }
    if (button == btnRIGHT)
    {
    timedBeep(shortBeep,1);
    return minutes;
    }
    lcd.setCursor(0,1);
    lcd.print(minutes);
    lcd.print(" ");
    }
    return 0;
    }

    void timedBeep(int beepTime, int beepCount)
    {
    for (int i = 0; i < beepCount; i ++)
    {
    digitalWrite(beeper, HIGH);
    delay(beepTime);
    digitalWrite(beeper, LOW);
    delay(beepTime);
    }
    }

    void lcdClear(){
    lcd.clear();
    lcd.begin(16,2);
    lcd.setCursor(0,0);
    }

    void timerCancelled(char message[])
    {
    lcdClear();
    lcd.print(message);
    lcd.print(" Cancelled");
    timedBeep(shortBeep,3);
    }

    void setOffAlarm()
    {
    int button = 0;
    int i = 0;
    Serial.println(i);
    digitalWrite(backLight, HIGH); // turn backlight on
    while (button != btnSELECT)
    {
    button = read_LCD_buttons();
    lcdClear();
    i++;
    if (i > 50)
    {
    lcdClear();
    lcd.print("Alert Alert");
    lcd.setCursor(0,1);
    lcd.print(" Alert Alert");
    i = 0;
    timedBeep(shortBeep,3);
    }

    }
    timerCancelled("Alarm");
    alarmSet = false;
    }

  • lajbi30

    csendes tag

    válasz Gergosz2 #1310 üzenetére

    OK az a baj,hogy az arduino belső óráját használja. Hogy kéne ebbe a kódba beillesztenem a külső órát?

  • lajbi30

    csendes tag

    válasz fecske13 #1312 üzenetére

    Kösz! Már olvastam párszor az oldalt. Nem az elképzeléssel van a baj,hanem a megvalósítással.
    Tudom,hogy mit szeretnék,de nem értek a programozáshoz.

  • lajbi30

    csendes tag

    válasz Robert7x #50 üzenetére

    Hali! egy kis segítség kellene!
    Időre szeretném kapcsólni a reléket egy RTC-vel,de nem értek a programozáshoz.
    Hogy lehetne ezt megvalósitani?

    /* YourDuino Example: 8-channel Solid State Relay Board
    This board is "active high".
    terry@yourduino.com */

    /*-----( Import needed libraries )-----*/
    /*-----( Declare Constants )-----*/
    #define RELAY_ON 1
    #define RELAY_OFF 0

    #define Relay_1 2 // Arduino Digital I/O pin number
    #define Relay_2 3
    #define Relay_3 4
    #define Relay_4 5
    #define Relay_5 6
    #define Relay_6 7
    #define Relay_7 8
    #define Relay_8 9
    /*-----( Declare objects )-----*/
    /*-----( Declare Variables )-----*/
    int waittime; // Delay between changes
    void setup() /****** SETUP: RUNS ONCE ******/
    {
    waittime = 1000;
    //-------( Initialize Pins so relays are inactive at reset)----
    digitalWrite(Relay_1, RELAY_OFF);
    digitalWrite(Relay_2, RELAY_OFF);
    digitalWrite(Relay_3, RELAY_OFF);
    digitalWrite(Relay_4, RELAY_OFF);
    digitalWrite(Relay_5, RELAY_OFF);
    digitalWrite(Relay_6, RELAY_OFF);
    digitalWrite(Relay_7, RELAY_OFF);
    digitalWrite(Relay_8, RELAY_OFF);

    //---( THEN set pins as outputs )----
    pinMode(Relay_1, OUTPUT);
    pinMode(Relay_2, OUTPUT);
    pinMode(Relay_3, OUTPUT);
    pinMode(Relay_4, OUTPUT);
    pinMode(Relay_5, OUTPUT);
    pinMode(Relay_6, OUTPUT);
    pinMode(Relay_7, OUTPUT);
    pinMode(Relay_8, OUTPUT);
    delay(4000); //Check that all relays are inactive at Reset

    }//--(end setup )---

    void loop() /****** LOOP: RUNS CONSTANTLY ******/
    {
    //---( Turn all 8 relays ON in sequence)---
    digitalWrite(Relay_1, RELAY_ON);// set the Relay ON
    delay(waittime); // wait for a second
    digitalWrite(Relay_2, RELAY_ON);// set the Relay ON
    delay(waittime); // wait for a second
    digitalWrite(Relay_3, RELAY_ON);// set the Relay ON
    delay(waittime); // wait for a second
    digitalWrite(Relay_4, RELAY_ON);// set the Relay ON
    delay(waittime);
    digitalWrite(Relay_5, RELAY_ON);// set the Relay ON
    delay(waittime); // wait for a second
    digitalWrite(Relay_6, RELAY_ON);// set the Relay ON
    delay(waittime); // wait for a second
    digitalWrite(Relay_7, RELAY_ON);// set the Relay ON
    delay(waittime); // wait for a second
    digitalWrite(Relay_8, RELAY_ON);// set the Relay ON
    delay(waittime * 4); // wait see all relays ON

    //---( Turn all 8 relays OFF in sequence)---
    digitalWrite(Relay_1, RELAY_OFF);// set the Relay OFF
    delay(waittime); // wait for a second
    digitalWrite(Relay_2, RELAY_OFF);// set the Relay OFF
    delay(waittime); // wait for a second
    digitalWrite(Relay_3, RELAY_OFF);// set the Relay OFF
    delay(waittime); // wait for a second
    digitalWrite(Relay_4, RELAY_OFF);// set the Relay OFF
    delay(waittime);
    digitalWrite(Relay_5, RELAY_OFF);// set the Relay OFF
    delay(waittime); // wait for a second
    digitalWrite(Relay_6, RELAY_OFF);// set the Relay OFF
    delay(waittime); // wait for a second
    digitalWrite(Relay_7, RELAY_OFF);// set the Relay OFF
    delay(waittime); // wait for a second
    digitalWrite(Relay_8, RELAY_OFF);// set the Relay OFF
    delay(waittime * 4); // wait see all relays OFF

    }//--(end main loop )---

    //*********( THE END )***********

  • lajbi30

    csendes tag

    válasz gyapo11 #1430 üzenetére

    Hali!

    Minden relét külön szeretnék kapcsolni. 8:00-kor az 1-es. 9:00-kor a 2-es.10:00-kor a 3-as.stb.
    Majd a lekapcsolás 16:00-kor az 1-es. 17:00-kor a 2-es.stb

  • lajbi30

    csendes tag

    válasz Gergosz2 #1433 üzenetére

    Alább megadtam a kódot, de nem tudom, hogy hova mit írjak és mit állítsak be. Ebben kéne valami segítség. :)

  • lajbi30

    csendes tag

    válasz lajbi30 #1434 üzenetére

    Igen! Én is inkább az órát használnám,nem a millist

    [ Szerkesztve ]

  • lajbi30

    csendes tag

    válasz gyapo11 #1438 üzenetére

    Hali!
    Meg tudná mondani valaki,hol a hiba?
    Időre szeretném be és kikapcsolni a reléket,de nem akar összejönni. Feltölti,de egyből bekapcsol a relé és nem kapcsol le.

    #include <Wire.h>

    int hour;
    int minute;
    int second;
    int relPin1 = 6; // 1-es csatorna
    int relPin2 = 7; // 2-es csatorna
    int relPin3 = 8; // 3-as csatorna
    int relPin4 = 9; // 4-es csatorna

    void setup()
    {
    Serial.begin(9600);
    Wire.begin();
    digitalWrite(relPin1, LOW);
    pinMode(relPin1,OUTPUT);
    digitalWrite(relPin2, LOW);
    pinMode(relPin2,OUTPUT);
    digitalWrite(relPin3, LOW);
    pinMode(relPin3,OUTPUT);
    digitalWrite(relPin4, LOW);
    pinMode(relPin4,OUTPUT);
    }

    void loop()
    {

    Wire.beginTransmission(104);
    Wire.write(0x00);
    Wire.endTransmission();
    Wire.requestFrom(104, 6);
    second = Wire.read();
    minute = Wire.read();
    hour = Wire.read();

    hour=hour/16 * 10 + hour % 16;
    minute=minute/16 * 10 + minute % 16;
    second=second/16 * 10 + second % 16;

    Serial.print(hour);
    Serial.print(":");
    if (minute < 10) { Serial.print("0"); }
    Serial.print(minute);
    Serial.print(":");
    if (second < 10) { Serial.print("0"); }
    Serial.print(second);
    Serial.print("\n");
    delay(1000);

    // Vilagitás (be) and (ki) ha 10:10 kor szeretned bekapcsolni, akkor 10x60+10=610, ezt ird be, hasonló az eljárás, a kikapcsolási idővel

    if (0*60+20=80 and 0*60+21=81)
    {
    digitalWrite (relPin1, HIGH);
    }
    else
    {
    digitalWrite (relPin1, LOW);
    }
    if (23*60+55>540 and 23*60+56<1140)
    {
    digitalWrite (relPin2, HIGH);
    }
    else
    {
    digitalWrite (relPin2, LOW);
    }

    }

    [ Szerkesztve ]

  • lajbi30

    csendes tag

    válasz Gergosz2 #1441 üzenetére

    Köszi a segítséget,de nem akar jó lenni.
    Be tudom állítani az órát ez már megy:) De nem tudom még összeollozni sem úgy,hogy az jó legyen.

  • lajbi30

    csendes tag

    válasz Gergosz2 #1444 üzenetére

    Ilyen apróságokat megoldok,ezzel nincsen gond.
    Ezzel a kóddal tudom beállítani az órát. Ez alapján DS3232 az RTC,de hiába írom át a te kódodban,hibát ír ki.

    #include <SoftI2C.h>
    #include <DS3232RTC.h>
    #include <avr/pgmspace.h>
    #include <string.h>

    SoftI2C i2c(A4, A5);
    DS3232RTC rtc(i2c);
    char buffer[64];
    size_t buflen;

    const char *days[] = {
    "Mon, ", "Tue, ", "Wed, ", "Thu, ", "Fri, ", "Sat, ", "Sun, "
    };

    const char *months[] = {
    " Jan ", " Feb ", " Mar ", " Apr ", " May ", " Jun ",
    " Jul ", " Aug ", " Sep ", " Oct ", " Nov ", " Dec "
    };

    static uint8_t monthLengths[] = {
    31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
    };

    inline bool isLeapYear(unsigned int year)
    {
    if ((year % 100) == 0)
    return (year % 400) == 0;
    else
    return (year % 4) == 0;
    }

    inline uint8_t monthLength(const RTCDate *date)
    {
    if (date->month != 2 || !isLeapYear(date->year))
    return monthLengths[date->month - 1];
    else
    return 29;
    }

    void setup() {
    Serial.begin(9600);
    buflen = 0;
    cmdHelp(0);
    }

    void loop() {
    if (Serial.available()) {
    // Process serial input for commands from the host.
    int ch = Serial.read();
    if (ch == 0x0A || ch == 0x0D) {
    // End of the current command. Blank lines are ignored.
    if (buflen > 0) {
    buffer[buflen] = '\0';
    buflen = 0;
    processCommand(buffer);
    }
    } else if (ch == 0x08) {
    // Backspace over the last character.
    if (buflen > 0)
    --buflen;
    } else if (buflen < (sizeof(buffer) - 1)) {
    // Add the character to the buffer after forcing to upper case.
    if (ch >= 'a' && ch <= 'z')
    buffer[buflen++] = ch - 'a' + 'A';
    else
    buffer[buflen++] = ch;
    }
    }
    }

    void printDec2(int value)
    {
    Serial.print((char)('0' + (value / 10)));
    Serial.print((char)('0' + (value % 10)));
    }

    void printProgString(PGM_P str)
    {
    for (;;) {
    char ch = (char)(pgm_read_byte(str));
    if (ch == '\0')
    break;
    Serial.print(ch);
    ++str;
    }
    }

    byte readField(const char *args, int &posn, int maxValue)
    {
    int value = -1;
    if (args[posn] == ':' && posn != 0)
    ++posn;
    while (args[posn] >= '0' && args[posn] <= '9') {
    if (value == -1)
    value = 0;
    value = (value * 10) + (args[posn++] - '0');
    if (value > 99)
    return 99;
    }
    if (value == -1 || value > maxValue)
    return 99;
    else
    return value;
    }

    // "TIME" command.
    void cmdTime(const char *args)
    {
    RTCTime time;
    if (*args != '\0') {
    // Set the current time.
    int posn = 0;
    time.hour = readField(args, posn, 23);
    time.minute = readField(args, posn, 59);
    if (args[posn] != '\0')
    time.second = readField(args, posn, 59);
    else
    time.second = 0;
    if (time.hour == 99 || time.minute == 99 || time.second == 99) {
    Serial.println("Invalid time format; use HH:MM:SS");
    return;
    }
    rtc.writeTime(&time);
    Serial.print("Time has been set to: ");
    }

    // Read the current time.
    rtc.readTime(&time);
    printDec2(time.hour);
    Serial.print(':');
    printDec2(time.minute);
    Serial.print(':');
    printDec2(time.second);
    Serial.println();
    }

    // "DATE" command.
    void cmdDate(const char *args)
    {
    RTCDate date;
    if (*args != '\0') {
    // Set the current date.
    unsigned long value = 0;
    while (*args >= '0' && *args <= '9')
    value = value * 10 + (*args++ - '0');
    if (value < 20000000 || value >= 21000000) {
    Serial.println("Year must be between 2000 and 2099");
    return;
    }
    date.day = (byte)(value % 100);
    date.month = (byte)((value / 100) % 100);
    date.year = (unsigned int)(value / 10000);
    if (date.month < 1 || date.month > 12) {
    Serial.println("Month must be between 1 and 12");
    return;
    }
    uint8_t len = monthLength(&date);
    if (date.day < 1 || date.day > len) {
    Serial.print("Day must be between 1 and ");
    Serial.println(len, DEC);
    return;
    }
    rtc.writeDate(&date);
    Serial.print("Date has been set to: ");
    }

    // Read the current date.
    rtc.readDate(&date);
    Serial.print(days[RTC::dayOfWeek(&date) - 1]);
    Serial.print(date.day, DEC);
    Serial.print(months[date.month - 1]);
    Serial.println(date.year, DEC);
    }

    // "TEMP" command.
    void cmdTemp(const char *args)
    {
    int temp = rtc.readTemperature();
    if (temp != RTC::NO_TEMPERATURE) {
    Serial.print(temp / 4.0);
    Serial.println(" degrees celcius");
    } else {
    Serial.println("Temperature is not available");
    }
    }

    void printAlarm(byte alarmNum, const RTCAlarm *alarm)
    {
    Serial.print("Alarm ");
    Serial.print(alarmNum + 1, DEC);
    Serial.print(": ");
    if (alarm->flags & 0x01) {
    printDec2(alarm->hour);
    Serial.print(':');
    printDec2(alarm->minute);
    Serial.println();
    } else {
    Serial.println("Off");
    }
    }

    // "ALARMS" command.
    void cmdAlarms(const char *args)
    {
    RTCAlarm alarm;
    for (byte alarmNum = 0; alarmNum < RTC::ALARM_COUNT; ++alarmNum) {
    rtc.readAlarm(alarmNum, &alarm);
    printAlarm(alarmNum, &alarm);
    }
    }

    const char s_ON[] PROGMEM = "ON";
    const char s_OFF[] PROGMEM = "OFF";

    // "ALARM" command.
    void cmdAlarm(const char *args)
    {
    RTCAlarm alarm;
    int posn = 0;
    byte alarmNum = readField(args, posn, RTC::ALARM_COUNT);
    if (!alarmNum || alarmNum == 99) {
    Serial.print("Alarm number must be between 1 and ");
    Serial.println(RTC::ALARM_COUNT, DEC);
    return;
    }
    --alarmNum;
    while (args[posn] == ' ' || args[posn] == '\t')
    ++posn;
    if (args[posn] != '\0') {
    // Set the alarm to a new value.
    if (matchString(s_ON, args + posn, strlen(args + posn))) {
    rtc.readAlarm(alarmNum, &alarm);
    alarm.flags = 1;
    } else if (matchString(s_OFF, args + posn, strlen(args + posn))) {
    rtc.readAlarm(alarmNum, &alarm);
    alarm.flags = 0;
    } else {
    alarm.hour = readField(args, posn, 23);
    alarm.minute = readField(args, posn, 59);
    if (alarm.hour == 99 || alarm.minute == 99) {
    Serial.println("Invalid alarm time format; use HH:MM");
    return;
    }
    alarm.flags = 1;
    }
    rtc.writeAlarm(alarmNum, &alarm);
    }

    // Print the current state of the alarm.
    rtc.readAlarm(alarmNum, &alarm);
    printAlarm(alarmNum, &alarm);
    }

    // "NVRAM" command.
    void cmdNvram(const char *args)
    {
    static const char hexchars[] = "0123456789ABCDEF";
    int count = rtc.byteCount();
    for (int offset = 0; offset < count; ++offset) {
    if ((offset % 16) == 0) {
    if (offset)
    Serial.println();
    Serial.print(hexchars[(offset >> 12) & 0x0F]);
    Serial.print(hexchars[(offset >> 8) & 0x0F]);
    Serial.print(hexchars[(offset >> 4) & 0x0F]);
    Serial.print(hexchars[offset & 0x0F]);
    Serial.print(':');
    Serial.print(' ');
    }
    byte value = rtc.readByte(offset);
    Serial.print(hexchars[(value >> 4) & 0x0F]);
    Serial.print(hexchars[value & 0x0F]);
    Serial.print(' ');
    }
    Serial.println();
    }

    // List of all commands that are understood by the sketch.
    typedef void (*commandFunc)(const char *args);
    typedef struct
    {
    PGM_P name;
    commandFunc func;
    PGM_P desc;
    PGM_P args;
    } command_t;
    const char s_cmdTime[] PROGMEM = "TIME";
    const char s_cmdTimeDesc[] PROGMEM =
    "Read or write the current time";
    const char s_cmdTimeArgs[] PROGMEM = "[HH:MM:SS]";
    const char s_cmdDate[] PROGMEM = "DATE";
    const char s_cmdDateDesc[] PROGMEM =
    "Read or write the current date";
    const char s_cmdDateArgs[] PROGMEM = "[YYYYMMDD]";
    const char s_cmdTemp[] PROGMEM = "TEMP";
    const char s_cmdTempDesc[] PROGMEM =
    "Read the current temperature";
    const char s_cmdAlarms[] PROGMEM = "ALARMS";
    const char s_cmdAlarmsDesc[] PROGMEM =
    "Print the status of all alarms";
    const char s_cmdAlarm[] PROGMEM = "ALARM";
    const char s_cmdAlarmDesc[] PROGMEM =
    "Read or write a specific alarm";
    const char s_cmdAlarmArgs[] PROGMEM = "NUM [HH:MM|ON|OFF]";
    const char s_cmdNvram[] PROGMEM = "NVRAM";
    const char s_cmdNvramDesc[] PROGMEM =
    "Print the contents of NVRAM, excluding alarms";
    const char s_cmdHelp[] PROGMEM = "HELP";
    const char s_cmdHelpDesc[] PROGMEM =
    "Prints this help message";
    const command_t commands[] PROGMEM = {
    {s_cmdTime, cmdTime, s_cmdTimeDesc, s_cmdTimeArgs},
    {s_cmdDate, cmdDate, s_cmdDateDesc, s_cmdDateArgs},
    {s_cmdTemp, cmdTemp, s_cmdTempDesc, 0},
    {s_cmdAlarms, cmdAlarms, s_cmdAlarmsDesc, 0},
    {s_cmdAlarm, cmdAlarm, s_cmdAlarmDesc, s_cmdAlarmArgs},
    {s_cmdNvram, cmdNvram, s_cmdNvramDesc, 0},
    {s_cmdHelp, cmdHelp, s_cmdHelpDesc, 0},
    {0, 0}
    };

    // "HELP" command.
    void cmdHelp(const char *)
    {
    int index = 0;
    for (;;) {
    PGM_P name = (PGM_P)(pgm_read_word(&(commands[index].name)));
    if (!name)
    break;
    PGM_P desc = (PGM_P)(pgm_read_word(&(commands[index].desc)));
    PGM_P args = (PGM_P)(pgm_read_word(&(commands[index].args)));
    printProgString(name);
    if (args) {
    Serial.print(' ');
    printProgString(args);
    }
    Serial.println();
    Serial.print(" ");
    printProgString(desc);
    Serial.println();
    ++index;
    }
    }

    // Match a data-space string where the name comes from PROGMEM.
    bool matchString(PGM_P name, const char *str, int len)
    {
    for (;;) {
    char ch1 = (char)(pgm_read_byte(name));
    if (ch1 == '\0')
    return len == 0;
    else if (len == 0)
    break;
    if (ch1 >= 'a' && ch1 <= 'z')
    ch1 = ch1 - 'a' + 'A';
    char ch2 = *str;
    if (ch2 >= 'a' && ch2 <= 'z')
    ch2 = ch2 - 'a' + 'A';
    if (ch1 != ch2)
    break;
    ++name;
    ++str;
    --len;
    }
    return false;
    }

    // Process commands from the host.
    void processCommand(const char *buf)
    {
    // Skip white space at the start of the command.
    while (*buf == ' ' || *buf == '\t')
    ++buf;
    if (*buf == '\0')
    return; // Ignore blank lines.

    // Extract the command portion of the line.
    const char *cmd = buf;
    int len = 0;
    for (;;) {
    char ch = *buf;
    if (ch == '\0' || ch == ' ' || ch == '\t')
    break;
    ++buf;
    ++len;
    }

    // Skip white space after the command name and before the arguments.
    while (*buf == ' ' || *buf == '\t')
    ++buf;

    // Find the command and execute it.
    int index = 0;
    for (;;) {
    PGM_P name = (PGM_P)(pgm_read_word(&(commands[index].name)));
    if (!name)
    break;
    if (matchString(name, cmd, len)) {
    commandFunc func =
    (commandFunc)(pgm_read_word(&(commands[index].func)));
    (*func)(buf);
    return;
    }
    ++index;
    }

    // Unknown command.
    Serial.println("Unknown command, valid commands are:");
    cmdHelp(0);
    }

  • lajbi30

    csendes tag

    válasz dave0825 #1446 üzenetére

    IGEN!!!
    Ezzel megy! De most nézegetem és lehet ,hogy DS1307 az óra modul.
    Igazából 4 db relét szeretnék időre vezérelni(be és kikapcsolni),de csak szívok vele.

  • lajbi30

    csendes tag

    válasz Gergosz2 #1451 üzenetére

    ok! Bocsi!

    Képek alapján DS1307 (Tiny RTC I2C) ez van ráírva. Arduino uno, 4-es relé panel.
    A reléket szeretném ídőre vezérelni.
    1-es relé bekapcsol 8:00-kor lekapcsol 21:00-kor
    2-es relé bekapcsol 9:00-kor lekapcsol 20:00-kor
    STB,STB

  • lajbi30

    csendes tag

    válasz Gergosz2 #1453 üzenetére

    Szerintem ez már részlet kérdés,mert ha sikerülne egy működő kódot írni,akkor az időt már úgy variálom ahogy akarom. Gondolom én!

  • lajbi30

    csendes tag

    válasz dave0825 #1455 üzenetére

    Nem keveredtem össze:)
    Leírtam mit szeretnék csak éppen hülye vagyok hozzá!:) Ezért kérem a segítségeteket.

    [ Szerkesztve ]

  • lajbi30

    csendes tag

    válasz Gergosz2 #1458 üzenetére

    Arduino: 1.6.5 (Windows 7), Board: "Arduino Uno"

    In file included from sketch_aug20b.ino:1:0:
    D:\Games\arduino-1.6.5-r2\libraries\DS1307/DS1307.h:10:24: fatal error: WConstants.h: No such file or directory
    #include <WConstants.h>
    ^
    compilation terminated.
    Hiba a fordítás során.

    This report would have more information with
    "Show verbose output during compilation"
    enabled in File > Preferences.

  • lajbi30

    csendes tag

    válasz Gergosz2 #1461 üzenetére

    Nagyok nagyok vagytok! Alakul! Tök izgulok:)
    Beállítani nem tudom a pontos időt. Valamiért elfogadta a DS3231 library-t.
    A kód is fel ment hiba nélkül, de a relék nem kapcsolnak.

    #include <DS3231.h>
    #include <Wire.h>

    DS3231 Clock;
    bool Century=false;
    bool h12;
    bool PM;
    byte ADay, AHour, AMinute, ASecond, ABits;
    bool ADy, A12h, Apm;
    byte year, month, date, DoW, hour, minute, second;

    //EZEKET ÍRD ÁT, NEM TUDOM, HOGY HOVA VANNAK KÖTVE A RELÉK, MEG MI LEGYEN A NEVE!
    int relPin1 = 6;
    int relPin2 = 7;
    int relPin3 = 8;
    int relPin4 = 9;

    void setup()
    {
    Wire.begin();
    pinMode(relPin1, OUTPUT);
    pinMode(relPin2, OUTPUT);
    pinMode(relPin3, OUTPUT);
    pinMode(relPin4, OUTPUT);
    }

    void loop()
    {
    int hour;
    hour=Clock.getHour(h12, PM);

    if (hour >= 00 && hour < 23)
    {
    digitalWrite(relPin1, HIGH); // 1-es relé 8 és 16 óra között kapcsol be
    }
    else
    {
    digitalWrite(relPin1, LOW); // 16 és 8 óra között ki van kapcsolva
    }

    if (hour >= 0 && hour <23)
    {
    digitalWrite(relPin2, HIGH);
    }
    else
    {
    digitalWrite(relPin2, LOW);
    }

    if (hour >= 0 && hour < 23)
    {
    digitalWrite(relPin3, HIGH);
    }
    else
    {
    digitalWrite(relPin3, LOW);
    }

    if (hour >= 0 && hour < 23)
    {
    digitalWrite(relPin4, HIGH);
    }
    else
    {
    digitalWrite(relPin4, LOW);
    }

    }

    [ Szerkesztve ]

  • lajbi30

    csendes tag

    válasz Gergosz2 #1465 üzenetére

    OK!
    DS3231 bemásólva, DS3231 Test felment rendesen,serial monitoron fut,de nem találom a setup-ot. Vagy azt be kell írni a serial monitoron?
    A kód is fel ment hiba nélkül,de nem kapcsolnak a relék. Jól van összerakva,mert tesztelni tudom a reléket.

  • lajbi30

    csendes tag

    válasz Gergosz2 #1467 üzenetére

    HÚ!! Nem egyszerű!
    DS1307 bemásolva,beállitva.
    Kód bemásólva,elfogadta:)
    Utcsó kérdés a nagy köszönöm elött. Mit kell átírni, ha változtatni szeretnék valamelyik relé kapcsolási idején?

  • lajbi30

    csendes tag

    válasz lajbi30 #1470 üzenetére

    Valami nem jó.
    16:00-kor le kellett volna kapcsolni az első relének,de ezt nem tette meg:)
    Ha átírom
    case 16:
    set_relay(1, 1);
    break;

    16-ot 15-re,akkor sem kapcsol le.

  • lajbi30

    csendes tag

    válasz nemethbuda #1477 üzenetére

    Hali mindenki!

    Megtudná nekem mondani valaki,hogy miért van az,hogy PC USB-rő tökéletesen működik az arduino,de kűlső tápról csak kínlódik. USB 5 volt-ról szépen felkapcsólnak a relék (4db),de külső tápról 2.relé után már csak búgnak és nem tudnak felkapcsólni. Lehet akár 12 volt is.

Új hozzászólás Aktív témák