Keresés

Hirdetés

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

  • olli

    tag

    válasz Vladi #7415 üzenetére

    Nem a vezetékekben kialakuló áramlökésekre, a rádiófrekvenciás zavarra érzékeny, vagy sima program hibára, vagy ..... bármire lefagyhat.
    Fűtés vezérlőt működtet egy nano lap, SSR relére cseréltem néhány power relét, csökkent a lefagyás, de:
    jelenleg a vezérlés nem fut, csak hőfok mérés szenzorokkal, RTC, LCD, igaz van aktív nagyfeszültségű környezet és néha így is lefagy.
    Más összeállításban az I2C LCD fagyogatott.

    By cool !

  • olli

    tag

    válasz cont #9772 üzenetére

    //3.2" GLCD
    UTFT myGLCD(CTE32,25,26,27,28);
    //Érintő képernyő
    URTouch myTouch( 6, 5, 32, 3, 2);

    Ezzel csak azt mondom, valahol a lábkiosztással lesz a gond.

    By cool !

  • olli

    tag

    válasz olli #9773 üzenetére

    // Standard Arduino Mega/Due shield : <display model>,38,39,40,41
    UTFT myGLCD(SSD1963_800480,38,39,40,41); //(byte model, int RS, int WR, int CS, int RST, int SER)

    UTouch myTouch( 43, 42, 44, 45, 46); //byte tclk, byte tcs, byte din, byte dout, byte irq

    Ezekkel a beállításokkal?

    A DUE-nak saját
    #include <UTFT.h>
    #include <URTouch.h>
    könyvtára van.

    [ Szerkesztve ]

    By cool !

  • olli

    tag

    válasz cont #9777 üzenetére

    https://www.ebay.com/itm/7-inch-TFT-LCD-Resistive-Touch-SSD1963-Shield-for-Arduino-Due-MEGA-2560-Library/291878571831?hash=item43f5518f37:g:FIUAAOSwNRdX3gas

    Könyvtárak és példák innét működnek?

    [ Szerkesztve ]

    By cool !

  • olli

    tag

    válasz olli #9784 üzenetére

    [CODE// URTouch_ButtonTest
    // Copyright (C)2015 Rinky-Dink Electronics, Henning Karlsen. All right reserved
    // web: http://www.RinkyDinkElectronics.com/
    //
    // This program is a quick demo of how create and use buttons.
    //
    // This program requires the UTFT library.
    //
    // It is assumed that the display module is connected to an
    // appropriate shield or that you know how to change the pin
    // numbers in the setup.
    //

    #include <UTFT.h>
    #include <URTouch.h>

    // Initialize display
    // ------------------
    // Set the pins to the correct ones for your development board
    // -----------------------------------------------------------
    // Standard Arduino Uno/2009 Shield : <display model>,19,18,17,16
    // Standard Arduino Mega/Due shield : <display model>,38,39,40,41
    // CTE TFT LCD/SD Shield for Arduino Due : <display model>,25,26,27,28
    // Teensy 3.x TFT Test Board : <display model>,23,22, 3, 4
    // ElecHouse TFT LCD/SD Shield for Arduino Due : <display model>,22,23,31,33
    //
    // Remember to change the model parameter to suit your display module!
    UTFT myGLCD(CTE32,25,26,27,28);

    // Initialize touchscreen
    // ----------------------
    // Set the pins to the correct ones for your development board
    // -----------------------------------------------------------
    // Standard Arduino Uno/2009 Shield : 15,10,14, 9, 8
    // Standard Arduino Mega/Due shield : 6, 5, 4, 3, 2
    // CTE TFT LCD/SD Shield for Arduino Due : 6, 5, 32, 3, 2
    // Teensy 3.x TFT Test Board : 26,31,27,28,29
    // ElecHouse TFT LCD/SD Shield for Arduino Due : 25,26,27,29,30
    //
    URTouch myTouch( 6, 5, 32, 3, 2);

    // Declare which fonts we will be using
    extern uint8_t BigFont[];

    int x, y;
    char stCurrent[20]="";
    int stCurrentLen=0;
    char stLast[20]="";

    /*************************
    ** Custom functions **
    *************************/

    void drawButtons()
    {
    // Draw the upper row of buttons
    for (x=0; x<5; x++)
    {
    myGLCD.setColor(0, 0, 255);
    myGLCD.fillRoundRect (10+(x*60), 10, 60+(x*60), 60);
    myGLCD.setColor(255, 255, 255);
    myGLCD.drawRoundRect (10+(x*60), 10, 60+(x*60), 60);
    myGLCD.printNumI(x+1, 27+(x*60), 27);
    }
    // Draw the center row of buttons
    for (x=0; x<5; x++)
    {
    myGLCD.setColor(0, 0, 255);
    myGLCD.fillRoundRect (10+(x*60), 70, 60+(x*60), 120);
    myGLCD.setColor(255, 255, 255);
    myGLCD.drawRoundRect (10+(x*60), 70, 60+(x*60), 120);
    if (x<4)
    myGLCD.printNumI(x+6, 27+(x*60), 87);
    }
    myGLCD.print("0", 267, 87);
    // Draw the lower row of buttons
    myGLCD.setColor(0, 0, 255);
    myGLCD.fillRoundRect (10, 130, 150, 180);
    myGLCD.setColor(255, 255, 255);
    myGLCD.drawRoundRect (10, 130, 150, 180);
    myGLCD.print("Clear", 40, 147);
    myGLCD.setColor(0, 0, 255);
    myGLCD.fillRoundRect (160, 130, 300, 180);
    myGLCD.setColor(255, 255, 255);
    myGLCD.drawRoundRect (160, 130, 300, 180);
    myGLCD.print("Enter", 190, 147);
    myGLCD.setBackColor (0, 0, 0);
    }

    void updateStr(int val)
    {
    if (stCurrentLen<20)
    {
    stCurrent[stCurrentLen]=val;
    stCurrent[stCurrentLen+1]='\0';
    stCurrentLen++;
    myGLCD.setColor(0, 255, 0);
    myGLCD.print(stCurrent, LEFT, 224);
    }
    else
    {
    myGLCD.setColor(255, 0, 0);
    myGLCD.print("BUFFER FULL!", CENTER, 192);
    delay(500);
    myGLCD.print(" ", CENTER, 192);
    delay(500);
    myGLCD.print("BUFFER FULL!", CENTER, 192);
    delay(500);
    myGLCD.print(" ", CENTER, 192);
    myGLCD.setColor(0, 255, 0);
    }
    }

    // Draw a red frame while a button is touched
    void waitForIt(int x1, int y1, int x2, int y2)
    {
    myGLCD.setColor(255, 0, 0);
    myGLCD.drawRoundRect (x1, y1, x2, y2);
    while (myTouch.dataAvailable())
    myTouch.read();
    myGLCD.setColor(255, 255, 255);
    myGLCD.drawRoundRect (x1, y1, x2, y2);
    }

    /*************************
    ** Required functions **
    *************************/

    void setup()
    {
    // Initial setup
    myGLCD.InitLCD();
    myGLCD.clrScr();

    myTouch.InitTouch();
    myTouch.setPrecision(PREC_MEDIUM);

    myGLCD.setFont(BigFont);
    myGLCD.setBackColor(0, 0, 255);
    drawButtons();
    }

    void loop()
    {
    while (true)
    {
    if (myTouch.dataAvailable())
    {
    myTouch.read();
    x=myTouch.getX();
    y=myTouch.getY();

    if ((y>=10) && (y<=60)) // Upper row
    {
    if ((x>=10) && (x<=60)) // Button: 1
    {
    waitForIt(10, 10, 60, 60);
    updateStr('1');
    }
    if ((x>=70) && (x<=120)) // Button: 2
    {
    waitForIt(70, 10, 120, 60);
    updateStr('2');
    }
    if ((x>=130) && (x<=180)) // Button: 3
    {
    waitForIt(130, 10, 180, 60);
    updateStr('3');
    }
    if ((x>=190) && (x<=240)) // Button: 4
    {
    waitForIt(190, 10, 240, 60);
    updateStr('4');
    }
    if ((x>=250) && (x<=300)) // Button: 5
    {
    waitForIt(250, 10, 300, 60);
    updateStr('5');
    }
    }

    if ((y>=70) && (y<=120)) // Center row
    {
    if ((x>=10) && (x<=60)) // Button: 6
    {
    waitForIt(10, 70, 60, 120);
    updateStr('6');
    }
    if ((x>=70) && (x<=120)) // Button: 7
    {
    waitForIt(70, 70, 120, 120);
    updateStr('7');
    }
    if ((x>=130) && (x<=180)) // Button: 8
    {
    waitForIt(130, 70, 180, 120);
    updateStr('8');
    }
    if ((x>=190) && (x<=240)) // Button: 9
    {
    waitForIt(190, 70, 240, 120);
    updateStr('9');
    }
    if ((x>=250) && (x<=300)) // Button: 0
    {
    waitForIt(250, 70, 300, 120);
    updateStr('0');
    }
    }

    if ((y>=130) && (y<=180)) // Upper row
    {
    if ((x>=10) && (x<=150)) // Button: Clear
    {
    waitForIt(10, 130, 150, 180);
    stCurrent[0]='\0';
    stCurrentLen=0;
    myGLCD.setColor(0, 0, 0);
    myGLCD.fillRect(0, 224, 319, 239);
    }
    if ((x>=160) && (x<=300)) // Button: Enter
    {
    waitForIt(160, 130, 300, 180);
    if (stCurrentLen>0)
    {
    for (x=0; x<stCurrentLen+1; x++)
    {
    stLast[x]=stCurrent[x];
    }
    stCurrent[0]='\0';
    stCurrentLen=0;
    myGLCD.setColor(0, 0, 0);
    myGLCD.fillRect(0, 208, 319, 239);
    myGLCD.setColor(0, 255, 0);
    myGLCD.print(stLast, LEFT, 208);
    }
    else
    {
    myGLCD.setColor(255, 0, 0);
    myGLCD.print("BUFFER EMPTY", CENTER, 192);
    delay(500);
    myGLCD.print(" ", CENTER, 192);
    delay(500);
    myGLCD.print("BUFFER EMPTY", CENTER, 192);
    delay(500);
    myGLCD.print(" ", CENTER, 192);
    myGLCD.setColor(0, 255, 0);
    }
    }
    }
    }
    }
    }
    ]

    URTouch.h

    /*
    URTouch.h - Arduino/chipKit library support for Color TFT LCD Touch screens
    Copyright (C)2016 Rinky-Dink Electronics, Henning Karlsen. All right reserved

    Basic functionality of this library are based on the demo-code provided by
    ITead studio.

    You can find the latest version of the library at
    http://www.RinkyDinkElectronics.com/

    This library is free software; you can redistribute it and/or
    modify it under the terms of the CC BY-NC-SA 3.0 license.
    Please see the included documents for further information.

    Commercial use of this library requires you to buy a license that
    will allow commercial use. This includes using the library,
    modified or not, as a tool to sell products.

    The license applies to all part of the library including the
    examples and tools supplied with the library.
    */

    #ifndef URTouch_h
    #define URTouch_h

    #define URTOUCH_VERSION 201

    #if defined(__AVR__)
    #include "Arduino.h"
    #include "hardware/avr/HW_AVR_defines.h"
    #elif defined(__PIC32MX__)
    #include "WProgram.h"
    #include "hardware/pic32/HW_PIC32_defines.h"
    #elif defined(__arm__)
    #include "Arduino.h"
    #include "hardware/arm/HW_ARM_defines.h"
    #endif

    #define PORTRAIT 0
    #define LANDSCAPE 1

    #define PREC_LOW 1
    #define PREC_MEDIUM 2
    #define PREC_HI 3
    #define PREC_EXTREME 4

    class URTouch
    {
    public:
    int16_t TP_X ,TP_Y;

    URTouch(byte tclk, byte tcs, byte tdin, byte dout, byte irq);

    void InitTouch(byte orientation = LANDSCAPE);
    void read();
    bool dataAvailable();
    int16_t getX();
    int16_t getY();
    void setPrecision(byte precision);

    void calibrateRead();

    private:
    regtype *P_CLK, *P_CS, *P_DIN, *P_DOUT, *P_IRQ;
    regsize B_CLK, B_CS, B_DIN, B_DOUT, B_IRQ;
    byte T_CLK, T_CS, T_DIN, T_DOUT, T_IRQ;
    long _default_orientation;
    byte orient;
    byte prec;
    byte display_model;
    long disp_x_size, disp_y_size, default_orientation;
    long touch_x_left, touch_x_right, touch_y_top, touch_y_bottom;

    void touch_WriteData(byte data);
    word touch_ReadData();

    #if defined(ENERGIA)
    volatile uint32_t* portOutputRegister(int value);
    volatile uint32_t* portInputRegister(int value);
    #endif
    };

    #endif

    By cool !

  • olli

    tag

    válasz MrChris #9788 üzenetére

    Úgy 5 évente előfordulva nem terhelem túl, remélem az olvasókat.
    Most az ÁLLAPOTGÉP-re rákeresve keveredtem újra ide.

    By cool !

  • olli

    tag

    válasz cont #9787 üzenetére

    Az Arduino IDE 1.8.7 verziót egyedül feltelepítve a DUE lappal futnak a beépített példák?
    Ha az megy, az innen-onnan leszedettek meg nem, nyilván rossz a forrás, a hibaüzenetek segíthetnek.
    Most megnéztem DUE-re egy saját programot, dobott egy csomó hibát, de tudom, hogy Mega-hoz vannak könyvtárak telepítve, azokat kellene törölni.

    By cool !

  • olli

    tag

    Hi!
    C:\Users\win11\OneDrive\Dokumentumok\Arduino\libraries\Bi-directional_AC_Energy_Meter\Bi-directional_AC_Energy_Meter.ino: In function 'void loop()':
    C:\Users\win11\OneDrive\Dokumentumok\Arduino\libraries\Bi-directional_AC_Energy_Meter\Bi-directional_AC_Energy_Meter.ino:550:58: error: no matching function for call to 'UTFT::print(float&, int&)'
    myGLCD.print(RMSVoltageMean,decimalPrecision );
    ^
    In file included from C:\Users\win11\OneDrive\Dokumentumok\Arduino\libraries\Bi-directional_AC_Energy_Meter\Bi-directional_AC_Energy_Meter.ino:135:0:
    c:\Users\win11\OneDrive\Dokumentumok\Arduino\libraries\UTFT/UTFT.h:215:8: note: candidate: void UTFT::print(char*, int, int, int)
    void print(char *st, int x, int y, int deg=0);
    ^~~~~
    c:\Users\win11\OneDrive\Dokumentumok\Arduino\libraries\UTFT/UTFT.h:215:8: note: candidate expects 4 arguments, 2 provided
    c:\Users\win11\OneDrive\Dokumentumok\Arduino\libraries\UTFT/UTFT.h:216:8: note: candidate: void UTFT::print(String, int, int, int)
    void print(String st, int x, int y, int deg=0);
    ^~~~~
    c:\Users\win11\OneDrive\Dokumentumok\Arduino\libraries\UTFT/UTFT.h:216:8: note: candidate expects 4 arguments, 2 provided
    exit status 1
    Compilation error: no matching function for call to 'UTFT::print(float&, int&)'
    A fenti hiba megoldására milyen módszert alkalmaznátok?

    By cool !

  • olli

    tag

    Sziasztok!
    Energia mérőhöz az eredeti programban nyomógombos lcd szerepel, a gombokkal kalibrál. Az lcd az A0 lábon csatlakozik.
                  /* 0.1- Button Function */
            
                  int buttonRead;
                  buttonRead = analogRead (0);                                                        // Read analog pin A0. Pin A0 automatically assigned for LCD Display Button function (cannot be changed)
                  currentButtonMillis = millis();
                  
                  if(currentButtonMillis - startButtonMillis >= 300)
                  {
                    
                      //Right button is pressed 
                      if (buttonRead < 60) 
                      { 
                          myGLCD.clrScr(); // Clear the screen (black)
                          myGLCD.setFont(BigFont);
                          myGLCD.setColor(0, 0, 255);
                          myGLCD.setBackColor(0, 0, 255);
                          myGLCD.print ("PRESS <SELECT>   ",20,20); 
                          myGLCD.print ("TO CALLIBRATE   ",20,50);
                          }       
         
                      // Up button is pressed 
                      if (buttonRead < 200 && buttonRead > 60)                                            // Press up button to go to upper page
                      {   
                          page = page - 1 ;
                          if( page <=0)
                          { page = 1;}
                          startButtonMillis = millis();
                      }    
                     
                      // Down button is pressed 
                      if (buttonRead < 400 && buttonRead > 200)                                          // Press down button to go to lower page
                      {   
                          page = page + 1;
                          if (page >3)
                          { page = 3; 
                          }
                          startButtonMillis = millis();
                      }      
         
                      // Left button is pressed 
                      if (buttonRead < 600 && buttonRead >400)
                      { 
                          myGLCD.clrScr(); // Clear the screen (black)
                          myGLCD.setFont(BigFont);
                          myGLCD.setColor(0, 0, 255);
                          myGLCD.setBackColor(0, 0, 255);
                          myGLCD.print ("PRESS <SELECT>   ",20,20); 
                          myGLCD.print ("TO CALLIBRATE   ",20,50);
                          } 
         
                      // Select button is pressed 
                      if (buttonRead < 800 && buttonRead > 600)
                      {   
                      currentOffsetRead = 1;                                                              // to activate offset for current  
                      voltageOffsetRead = 1;                                                              // to activate offset for voltage
                      powerOffsetRead = 1;                                                                // to activate offset for power                                                                 // set display words starting at upper left corner
                      myGLCD.print ("INITIALIZING..... ",20,120);                                                                 // set display words starting at lower left corner
                      myGLCD.print ("WAIT 5 SEC ..... ",20,150);
                      }
                  }

    A nyomógombos lcd hiányában kihagyható: // Offset will automatically callibrate when SELECT Button on the LCD Display Shield is pressed.
    // If you do not have LCD Display Shield, look into serial monitor to add or minus the value manually and key in here.
    Pontosan hogyan tudom módosítani az értéket?
    Érintő képernyő + mega 2560 lesz az alap hardwer, az érintőképernyő
    gombjaival ki lehet váltani a fizikai gombokat?
    Pl. megoldás egy pwm lábon kiadni a feszültség szinteket az A0 lábra?

    By cool !

  • olli

    tag

    válasz Aryes #19040 üzenetére

    [link]

    Ez az eredeti kód, hogyan oldjam meg a kalibrálást az lcd gombok nélkül?

    Átraktam a próba topikba.

    [ Módosította: Intruder2k5 ]

    By cool !

  • olli

    tag

    válasz Aryes #19042 üzenetére

    Köszi, működik.
    A következő lépés az áram és feszmérő szenzorok csatlakoztatása.
    Jelenleg a glcd-re kiírja az adatokat, printeli serialra.
    Sd kártyára is megírtam csv-be mentésre, együtt a printseriallal
    hibázik.
    Csökkenteni kellene a glcd-re kiírás, a serialprint, sd mentés számát, vagy elhagyni valamelyiket?

    By cool !

  • olli

    tag

    válasz Aryes #19045 üzenetére

    A szenzorok bekötve, mérés még nincs, egy ellenállás létra szolgál öt nyomógombbal a keypad funkciókkal.
    Nem fut a gombok megnyomása utáni lcd kiírás, a frekvencia mérés után az első page == 1 kiírást jeleníti meg, visszalép a frekvencia mérésre és újra page == 1-re.
    Hibás a kód, vagy ténylegesen végezzen mérést valós feszültséggel?

    By cool !

  • olli

    tag

    válasz Aryes #19203 üzenetére

    Right=285, Up=508, Down=735, Left=909, Select=983;
    ```cpp
    //Right button is pressed
    if (buttonRead <400)
    ```
    ```cpp
    // Up button is pressed
    if (buttonRead <600 && buttonRead > 400)
    ```
    és így tovább, érzékeli, kivéve induláskor a select-et, az akkor nincs lenyomva az a gomb, valahol 400 és 600 közötti értéket mutat az A0.
    Magasabb feszültséggel lehetne növelni, az egy átkapcsolás 10V-ról 5V-ra.
    A gombok lenyomása után ~ nullázódnak az értékek mivel nincs még mérhető feszültség beadva a szenzorokra.

    [ Szerkesztve ]

    By cool !

  • olli

    tag

    válasz Aryes #19205 üzenetére

    A panel saját gnd és +5V.
    Állítsam A0= HIGH-ra ?

    [ Szerkesztve ]

    By cool !

  • olli

    tag

    válasz Aryes #19207 üzenetére


    Megépítettem a gombsort. Számít az valamit, hogy egyelőre mint a RIGHT gombnál a 4-es 3-as átkötést még nem csináltam meg a többinél sem?

    By cool !

  • olli

    tag

    válasz Aryes #19220 üzenetére

    Visszaírtam az eredeti gomb értékeket.
    Sd-re és serialra kiírja a mérések eredményét, a kijelző csak villog.
    A SELECT-et 1024-600 értékre módosítva a page=1 kiírja a megfelelő adatokat, de a page=2 és page=3 nem jeleníti meg.
    A többi gomb lenyomása kivált lépést, 600-800 tartományban a SELECT nem.

    By cool !

  • olli

    tag

    válasz Aryes #19232 üzenetére

    Ha nincs gomb lenyomva a tápfeszültséget méri az A0, az 1024, lenyomott SELECT-en 740-et, az benne van a 600-800 tartományban.

    By cool !

  • olli

    tag

    válasz olli #19233 üzenetére

    A tartomány volt rosszul megadva....
    < helyett >
    A fel, le gombok léptetik a page 1,2,3-at.
    A kalibrálás is működik.

    [ Szerkesztve ]

    By cool !

  • olli

    tag

    válasz Aryes #19236 üzenetére

    A tényleges működés tesztelése következik a 230V mérőhely kialakítása után.
    Közben elkezdhetek azon gondolkodni, hogy hogyan tovább egy napelemes rendszer vezérlés kivitelezéséhez.
    Mérve a kétirányú energiát, kitáplálás helyett optimalizálni kell a ház fogyasztását, esetleg tárolni átmeneti pufferben.

    By cool !

  • olli

    tag

    válasz Pero #19259 üzenetére

    A tápra csatlakoztatva mérhető az 5V és a 3.3V?
    Nálam a mega 2560 LD1117S50CTR IC megfeküdt, cserélni kell.

    By cool !

  • olli

    tag

    WiFi LoRa 32 +DS3231 rtc .
    Létezik arduino alatt feltölthető program amivel nemcsak a feltöltéskori dátum és idő marad meg, másnap reset után?

    By cool !

  • olli

    tag

    válasz olli #19540 üzenetére

    [link] rtc_master
    [link] oled könyvtár
    [link] szintén,
    ezek hiba nélkül fordítódnak esp32+ds3231 kódban.
    Ami nem sikerül, az aktuális dátum/idő másnap, reset után, csak a fordítás időpontját mutatja.
    25.50 C
    20.25 C
    32.00 C
    Sending packet: 10
    Saturday, March 04 2023 20:04:17
    Mai állapot.

    #include <OneWire.h>
    #include <DallasTemperature.h>
    #define ONE_WIRE_BUS 13
    OneWire oneWire(ONE_WIRE_BUS);
    DallasTemperature sensors(&oneWire);
    DeviceAddress D0 = { 0x28, 0x31, 0xBF, 0x29, 0x07, 0x00, 0x00, 0x7D }; // "T1"
    DeviceAddress D1 = { 0x28, 0x4F, 0x8E, 0x2A, 0x07, 0x00, 0x00, 0x37 }; // "T2"
    /* for normal hardware wire use above */
    #include <Wire.h>
    #include <RtcDS3231.h>
    RtcDS3231<TwoWire> Rtc(Wire);
    // handy routine to return true if there was an error
    // but it will also print out an error message with the given topic
    bool wasError(const char* errorTopic = "")
    {
    uint8_t error = Rtc.LastError();
    if (error != 0)
    {
    Serial.print("[");
    Serial.print(errorTopic);
    Serial.print("] WIRE communications error (");
    Serial.print(error);
    Serial.print(") : ");

    switch (error)
    {
    case Rtc_Wire_Error_None:
    Serial.println("(none?!)");
    break;
    case Rtc_Wire_Error_TxBufferOverflow:
    Serial.println("transmit buffer overflow");
    break;
    case Rtc_Wire_Error_NoAddressableDevice:
    Serial.println("no device responded");
    break;
    case Rtc_Wire_Error_UnsupportedRequest:
    Serial.println("device doesn't support request");
    break;
    case Rtc_Wire_Error_Unspecific:
    Serial.println("unspecified error");
    break;
    case Rtc_Wire_Error_CommunicationTimeout:
    Serial.println("communications timed out");
    break;
    }
    return true;
    }
    return false;
    }
    #include <Arduino.h>
    #include "Wire.h"
    #include "oled.h"
    #include <WiFi.h>
    #include "time.h"
    #include <LoRa.h>
    #include "secrets.h" // WiFi SSID & password
    #define SCK 5 // GPIO5 -- SX1278's SCK
    #define MISO 19 // GPIO19 -- SX1278's MISO
    #define MOSI 27 // GPIO27 -- SX1278's MOSI
    #define SS 18 // GPIO18 -- SX1278's CS
    #define RST 14 // GPIO14 -- SX1278's RESET
    #define DI0 26 // GPIO26 -- SX1278's IRQ(Interrupt Request)
    #define BAND 433E6

    unsigned int counter = 0;
    #define RTC_ADDRESS 0x68 // I2C eszköz címe
    String rssi = "RSSI --";
    String packSize = "--";
    String packet ;
    struct tm timeinfo;
    static char msg[20]; // character buffer
    OLED display = OLED(4, 15, 16, 0x3C, 128, 32, true); // SSD1306

    void setup() {
    pinMode(16,OUTPUT);
    pinMode(25,OUTPUT);
    digitalWrite(16, LOW); // set GPIO16 low to reset OLED
    delay(50);
    digitalWrite(16, HIGH); // while OLED is running, must set GPIO16 in high
    Serial.begin(115200);
    while (!Serial);

    SPI.begin(SCK,MISO,MOSI,SS);
    LoRa.setPins(SS,RST,DI0);
    if (!LoRa.begin(433E6)) {
    Serial.println("Starting LoRa failed!");
    while (1);
    }
    Serial.println("init ok");

    Wire.begin();
    display.begin();
    display.clear();
    display.draw_string(4, 8, "RTC clock", OLED::DOUBLE_SIZE);
    display.display();

    //------- Initialize the Temperature measurement library--------------
    sensors.begin();
    sensors.setResolution(D0, 10); //T1
    sensors.setResolution(D1, 10); //T2
    }
    void loop() {

    sensors.requestTemperatures();
    float T1 = sensors.getTempC(D0);
    float T2 = sensors.getTempC(D1);
    Serial.print("Sending packet: ");
    Serial.println(counter);
    // send packet
    LoRa.beginPacket();
    LoRa.print("hello ");
    LoRa.print(counter);
    LoRa.endPacket();

    counter++;
    digitalWrite(25, HIGH); // turn the LED on (HIGH is the voltage level)
    delay(1000); // wait for a second
    digitalWrite(25, LOW); // turn the LED off by making the voltage LOW
    delay(1000);
    getTime(&timeinfo); // display time/date
    Serial.println(&timeinfo, "%A, %B %d %Y %H:%M:%S");
    RtcTemperature temp = Rtc.GetTemperature();
    if (!wasError("loop GetTemperature"))
    {
    temp.Print(Serial);
    // you may also get the temperature as a float and print it
    // Serial.print(temp.AsFloatDegC());
    Serial.println(" C ");
    }
    display.clear();
    strftime (msg, 15, "%Y-%b-%d %a ", &timeinfo);
    display.draw_string(16, 1, msg); // Display date
    strftime (msg, 10, "%T ", &timeinfo); // Display time
    display.draw_string(8, 12, msg, OLED::DOUBLE_SIZE);
    display.display(); // Refresh screen
    delay(3000);
    display.clear();
    display.setCursor(8,0);
    display.println("T1= ");
    display.setCursor(30,0);
    display.println(T1);
    display.setCursor(60, 0);
    display.println(" C");
    display.setCursor(8,12);
    display.println("T2= ");
    display.setCursor(30,12);
    display.println(T2);
    display.setCursor(60, 12);
    display.println(" C");
    display.display();
    Serial.print(sensors.getTempC(D0));
    Serial.println(" C");
    Serial.print(sensors.getTempC(D1));
    Serial.println(" C ");
    }
    //--- Convert decimal numbers to BCD -----------------------
    byte decToBcd(byte val) {
    return ( (val / 10 * 16) + (val % 10) );
    }
    //--- Convert BCD numbers to decimal ----------------------
    byte bcdToDec(byte val) {
    return ( (val / 16 * 10) + (val % 16) );
    }
    /*--- Set RTC time/date ------------------------------------
    void setTime(struct tm* time) {
    Wire.beginTransmission(RTC_ADDRESS);
    Wire.write(0); // set register pointer to 00h
    Wire.write(decToBcd(time->tm_sec)); // set seconds
    Wire.write(decToBcd(time->tm_min)); // set minutes
    Wire.write(decToBcd(time->tm_hour)); // set hours
    Wire.write(time->tm_wday + 1); // set day of week (1=Sun, 7=Sat)
    Wire.write(decToBcd(time->tm_mday)); // set date (1 to 31)
    Wire.write(decToBcd(time->tm_mon) + 1); // set month
    Wire.write(decToBcd(time->tm_year - 100)); // year from 2000 (0 to 99)
    Wire.endTransmission();
    }*/
    //--- Read time/date from RTC ------------------------------
    void getTime(struct tm* time) {
    Wire.beginTransmission(RTC_ADDRESS);
    Wire.write(0); // a kiolvasás kezdőcímének beállítása
    Wire.endTransmission(false);
    Wire.requestFrom(RTC_ADDRESS, 7); // Hét bájt kiolvasása (time/date)
    time->tm_sec = bcdToDec(Wire.read() & 0x7f); // Másodpercek (0-59)
    time->tm_min = bcdToDec(Wire.read()); // Percek (0 - 59)
    time->tm_hour = bcdToDec(Wire.read() & 0x3f); // Órák (24h kijelzéshez)
    time->tm_wday = bcdToDec(Wire.read() - 1); // Hét napja (0 - 6)
    time->tm_mday = bcdToDec(Wire.read()); // hónap napja (1 - 31)
    time->tm_mon = bcdToDec(Wire.read() - 1); // hónap sorszáma (0 - 11)
    time->tm_year = bcdToDec(Wire.read()) + 100; // 1900-tól eltelt évek
    }

    [ Szerkesztve ]

    By cool !

  • olli

    tag

    válasz lanszelot #19551 üzenetére

    #include "max6675.h"
    #include <Adafruit_GFX.h>
    #include <Adafruit_SH1106.h>
    #include <Adafruit_Sensor.h>
    A felsorolt könyvtárak telepítve vannak?

    By cool !

  • olli

    tag

    válasz olli #19553 üzenetére

    c:\Arduino\libraries\Adafruit_SH1106-master\Adafruit_SH1106.cpp:29:26: fatal error: avr/pgmspace.h: No such file or directory
    compilation terminated.
    exit status 1
    Compilation error: exit status 1
    Na itt fejeztem be esp32-őn.

    By cool !

  • olli

    tag

    válasz lanszelot #19744 üzenetére

    Ez az érzékelő nem egyedi alkohol vegyi érzékelő, nem gázkromatográf, nem ilyen egyedi mérőeszköz: [link]
    [link]
    If you power off the heater letting the temperature goes down, you have to preheat it again, every time.
    We can detect more than one gas, but, keep in mind that it's not a true single gas detection. The chemical resistance inside this sensor react (if heated), to more than one gas, it can not isolate a single gas. So, what you get by conversion, is a resistance value to a ppm value, of many gas. However, if just one gas changed, or the other gases remains almost constant, you can get that changes. If you are able to mantain constant values for all the gas, and modify just one gas, then you can obtain the gas response over the sensor. The builder of this sensor does this job, making the figure i use for gas convertion. You can not be shure you are measuring just one gas.
    Also consider that, the chimical resistance degradate in a few years, I've read somewhere (can't remember well), 2 years.

    By cool !

  • olli

    tag

    válasz lanszelot #19746 üzenetére

    A kalibrálást is leírja a fenti linkeken, az egyes anyagokhoz.
    Ismert koncentrációjú mintákat kell készíteni az adott anyaghoz, azzal kalibrálni a szenzort.
    Vagy egy kalibrált eszközzel összevetni.

    By cool !

  • olli

    tag

    válasz tibi-d #19843 üzenetére

    A korlátozni kívánt hőfoktól függően kell termosztátot vagy hőkorlátozót beiktatni.

    By cool !

  • olli

    tag

    ```cpp
    #include <SPI.h>
    #include <LoRa.h>
    int state;
    //LoRa32u4 ports
    #define SS 8
    #define RST 4
    #define DI0 7
    #define BAND 433E6
    void setup() {
    Serial.begin(115200);

    pinMode(13, OUTPUT); // fehér led sets the pin as output for relay
    digitalWrite(13,HIGH);
    //while (!Serial); //if just the the basic function, must connect to a computer
    delay(1000);

    SPI.begin();
    LoRa.setPins(SS,RST,DI0);
    Serial.println("LoRa Receiver");

    if (!LoRa.begin(433E6)) {
    Serial.println("Starting LoRa failed!");
    while (1);
    }
    Serial.println("LoRa Initial OK!");
    }
    /*----( LOOP: RUNS CONSTANTLY )----*/
    void loop() {
    digitalWrite(13,LOW);
    // try to parse packet
    int packetSize = LoRa.parsePacket();
    if (packetSize) {
    // received a packet
    Serial.print("Received packet :");
    // read packet
    while (LoRa.available()) {
    Serial.print((char)LoRa.read());
    }
    // print RSSI of packet
    Serial.print("' with RSSI ");
    Serial.println(LoRa.packetRssi());
    while (LoRa.available()) {
    Serial.println();
    state = ((char)LoRa.read());

    }

    if (state == 1) //If this code received then turn on pump
    {
    Serial.println("Pump ON");
    digitalWrite(13,LOW); //Pump relay ON
    delay(500);
    }
    if (state == 0) //If this code received then turn off pump
    {
    Serial.println("Tank Full - Pump OFF");
    digitalWrite(13,HIGH); //Pump relay OFF
    delay(3000);
    }
    }

    }

    serial print:```
    Received packet :hello 16.2515.25112121' with RSSI -78 Tank Full - Pump OFF
    Küldő oldalon mit is kellene megadnom, hogy kiváltsa a relé on-off kapcsolását?

    By cool !

  • olli

    tag

    válasz Aryes #20119 üzenetére

    sensors.requestTemperatures();
    float T1 = sensors.getTempC(D0);
    float T2 = sensors.getTempC(D1);
    Serial.print("Sending packet: ");
    Serial.println(counter);
    // send packet
    LoRa.beginPacket();
    LoRa.print("hello ");
    LoRa.print( T1);
    LoRa.print( T2 );
    LoRa.print(counter);
    LoRa.endPacket();
    A küldő LoRa packet összeállítása jelenleg.
    Még nem világos, így mitől =0 az állapot?
    Továbbra is küldeném a fenti adatokat + a relé kapcsolását.
    Egyszerre, vagy külön mehet?

    By cool !

  • olli

    tag

    válasz Aryes #20135 üzenetére


    ```cpp
    #define boiler 23 // villanyra kapcsol,rel1
    #define gaz_kazan 17 // gázra kapcsol,rel2
    #include <OneWire.h>
    #include <DallasTemperature.h>
    #define ONE_WIRE_BUS 13
    OneWire oneWire(ONE_WIRE_BUS);
    DallasTemperature sensors(&oneWire);
    DeviceAddress D0 = { 0x28, 0x31, 0xBF, 0x29, 0x07, 0x00, 0x00, 0x7D }; // "T1"
    DeviceAddress D1 = { 0x28, 0x4F, 0x8E, 0x2A, 0x07, 0x00, 0x00, 0x37 }; // "T2"
    #include <Wire.h>
    const char* ssid = "";
    const char* password = "";
    const char* ntpServer = "hu.pool.ntp.org";
    const long gmtOffset_sec = 0;
    const int daylightOffset_sec = 3600;
    #define RTC_ADDRESS 0x68
    #include <RtcDS3231.h>
    RtcDS3231<TwoWire> Rtc(Wire);
    // Convert normal decimal numbers to binary coded decimal
    byte decToBcd(byte val){
    return( (val/10*16) + (val%10) );
    }

    // Convert binary coded decimal to normal decimal numbers
    byte bcdToDec(byte val){
    return( (val/16*10) + (val%16) );
    }
    #include <Arduino.h>
    #include "Wire.h"
    #include "oled.h"
    #include <WiFi.h>
    #include "time.h"
    #include <LoRa.h>

    #define SCK 5 // GPIO5 -- SX1278's SCK
    #define MISO 19 // GPIO19 -- SX1278's MISO
    #define MOSI 27 // GPIO27 -- SX1278's MOSI
    #define SS 18 // GPIO18 -- SX1278's CS
    #define RST 14 // GPIO14 -- SX1278's RESET
    #define DI0 26 // GPIO26 -- SX1278's IRQ(Interrupt Request)
    #define BAND 433E6

    unsigned int counter = 0;
    String rssi = "RSSI --";
    String packSize = "--";
    String packet ;
    struct tm timeinfo;
    static char msg[20]; // character buffer
    OLED display = OLED(4, 15, 16, 0x3C, 128, 32, true); // SSD1306
    void szelep_vez ()
    //T1+T2 >75 II T1>50= a boilerben van melegvíz
    //rel2/pin17 villanyra kapcsol
    //T1+T2<75 II T1<50= gáz melegíti a vizet
    //rel1/pin23 gázra kapcsol
    {
    sensors.requestTemperatures();
    float T1 = sensors.getTempC(D0);
    float T2 = sensors.getTempC(D1);
    if((T1+T2) > 75 || T1>49)
    {
    display.begin();
    display.clear();
    display.draw_string(4, 8, "BOILER", OLED::DOUBLE_SIZE);
    display.display();
    digitalWrite(boiler, HIGH);
    digitalWrite(gaz_kazan, LOW);
    delay(5000);
    }
    else
    {
    display.begin();
    display.clear();
    display.draw_string(4, 8, "GAZ_KAZAN", OLED::DOUBLE_SIZE);
    display.display();
    digitalWrite(gaz_kazan, HIGH);
    digitalWrite(boiler, LOW);
    delay(5000);
    }
    }
    void setup(){
    pinMode(boiler, OUTPUT); //villanyra kapcsol
    digitalWrite(boiler, LOW);
    pinMode(gaz_kazan, OUTPUT); //gázra kapcsol
    digitalWrite(gaz_kazan, LOW);
    pinMode(16,OUTPUT);
    pinMode(25,OUTPUT);
    digitalWrite(16, LOW); // set GPIO16 low to reset OLED
    delay(50);
    digitalWrite(16, HIGH); // while OLED is running, must set GPIO16 in high
    Serial.begin(115200);
    while (!Serial);

    SPI.begin(SCK,MISO,MOSI,SS);
    LoRa.setPins(SS,RST,DI0);
    if (!LoRa.begin(433E6)) {
    Serial.println("Starting LoRa failed!");
    while (1);
    }
    Serial.println("init ok");

    Wire.begin();
    Serial.setDebugOutput(true);
    //setTime(&timeinfo); // Valamikor be kell állítani az órát...
    Serial.print("Connecting to ");
    Serial.print(ssid);
    WiFi.begin(ssid, password);
    while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
    }
    Serial.println("");
    Serial.println("WiFi connected.");
    // Init and get the time

    configTime(gmtOffset_sec, daylightOffset_sec, ntpServer);
    printLocalTime();

    Serial.println();
    Serial.print("Connected! IP address: ");
    Serial.println(WiFi.localIP());
    //disconnect WiFi as it's no longer needed
    WiFi.disconnect(true);
    WiFi.mode(WIFI_OFF);
    display.begin();
    display.clear();
    display.draw_string(4, 8, "RTC clock", OLED::DOUBLE_SIZE);
    display.display();

    //------- Initialize the Temperature measurement library--------------
    sensors.begin();
    sensors.setResolution(D0, 10); //T1
    sensors.setResolution(D1, 10); //T2
    // set the initial time here:
    //DS3231 seconds, minutes, hours, day, date, month, year
    //setDS3231time(00,34,12,2,6,3,23);
    }

    void loop(){
    sensors.requestTemperatures();
    float T1 = sensors.getTempC(D0);
    float T2 = sensors.getTempC(D1);
    Serial.print("Sending packet: ");
    Serial.println(counter);
    // send packet
    LoRa.beginPacket();
    LoRa.print("hello ");
    LoRa.print( T1);
    LoRa.print( T2 );
    LoRa.print(counter);
    LoRa.endPacket();

    counter++;
    digitalWrite(25, HIGH); // turn the LED on (HIGH is the voltage level)
    delay(1000); // wait for a second
    digitalWrite(25, LOW); // turn the LED off by making the voltage LOW
    delay(1000);
    getLocalTime(&timeinfo); // display time/date
    Serial.println(&timeinfo, "%A, %B %d %Y %H:%M:%S");
    RtcTemperature temp = Rtc.GetTemperature();
    temp.Print(Serial);
    // you may also get the temperature as a float and print it
    // Serial.print(temp.AsFloatDegC());
    Serial.println(" C ");
    display.clear();
    strftime (msg, 15, "%Y-%b-%d %a ", &timeinfo);
    display.draw_string(16, 1, msg); // Display date
    strftime (msg, 10, "%T ", &timeinfo); // Display time
    display.draw_string(8, 12, msg, OLED::DOUBLE_SIZE);
    display.display(); // Refresh screen
    delay(3000);
    display.clear();
    display.setCursor(8,0);
    display.println("T1= ");
    display.setCursor(30,0);
    display.println(T1);
    display.setCursor(60, 0);
    display.println(" C");
    display.setCursor(8,12);
    display.println("T2= ");
    display.setCursor(30,12);
    display.println(T2);
    display.setCursor(60, 12);
    display.println(" C");
    display.display();
    Serial.print(sensors.getTempC(D0));
    Serial.println(" C");
    Serial.print(sensors.getTempC(D1));
    Serial.println(" C ");
    //printLocalTime(); // display the real-time clock data on the Serial Monitor,
    delay(1000); // every second
    szelep_vez();
    }

    //--- Set RTC time/date ------------------------------------
    void setLocalTime(struct tm* time) {
    struct tm timeinfo;
    Wire.beginTransmission(RTC_ADDRESS);
    Wire.write(0); // set register pointer to 00h
    Wire.write(decToBcd(time->tm_sec)); // set seconds
    Wire.write(decToBcd(time->tm_min)); // set minutes
    Wire.write(decToBcd(time->tm_hour)); // set hours
    Wire.write(time->tm_wday + 1); // set day of week (1=Sun, 7=Sat)
    Wire.write(decToBcd(time->tm_mday)); // set date (1 to 31)
    Wire.write(decToBcd(time->tm_mon) + 1); // set month
    Wire.write(decToBcd(time->tm_year - 100)); // year from 2000 (0 to 99)
    Wire.endTransmission();
    }
    //--- Read time/date from RTC ------------------------------
    void getTime(struct tm* time) {
    Wire.beginTransmission(RTC_ADDRESS);
    Wire.write(0); // a kiolvasás kezdőcímének beállítása
    Wire.endTransmission(false);
    Wire.requestFrom(RTC_ADDRESS, 7); // Hét bájt kiolvasása (time/date)
    time->tm_sec = bcdToDec(Wire.read() & 0x7f); // Másodpercek (0-59)
    time->tm_min = bcdToDec(Wire.read()); // Percek (0 - 59)
    time->tm_hour = bcdToDec(Wire.read() & 0x3f); // Órák (24h kijelzéshez)
    time->tm_wday = bcdToDec(Wire.read() - 1); // Hét napja (0 - 6)
    time->tm_mday = bcdToDec(Wire.read()); // hónap napja (1 - 31)
    time->tm_mon = bcdToDec(Wire.read() - 1); // hónap sorszáma (0 - 11)
    time->tm_year = bcdToDec(Wire.read()) + 100; // 1900-tól eltelt évek
    }
    void printLocalTime(){
    struct tm timeinfo;
    if(!getLocalTime(&timeinfo)){
    Serial.println("Failed to obtain time");
    return;
    }
    Serial.println(&timeinfo, "%A, %B %d %Y %H:%M:%S");
    Serial.print("Day of week: ");
    Serial.println(&timeinfo, "%A");
    Serial.print("Month: ");
    Serial.println(&timeinfo, "%B");
    Serial.print("Day of Month: ");
    Serial.println(&timeinfo, "%d");
    Serial.print("Year: ");
    Serial.println(&timeinfo, "%Y");
    Serial.print("Hour: ");
    Serial.println(&timeinfo, "%H");
    Serial.print("Hour (12 hour format): ");
    Serial.println(&timeinfo, "%I");
    Serial.print("Minute: ");
    Serial.println(&timeinfo, "%M");
    Serial.print("Second: ");
    Serial.println(&timeinfo, "%S");

    Serial.println("Time variables");
    char timeHour[3];
    strftime(timeHour,3, "%H", &timeinfo);
    Serial.println(timeHour);
    char timeWeekDay[10];
    strftime(timeWeekDay,10, "%A", &timeinfo);
    Serial.println(timeWeekDay);
    Serial.println();
    }
    /*void setup_sntp() {
    const char* ntpServer = "hu.pool.ntp.org"; // regionális NTP hálózat
    const char* time_zone = "CET-1CEST,M3.5.0,M10.5.0/3"; // Europe/Budapest időzóna
    configTzTime(time_zone, ntpServer); // Időzóna megadása
    Serial.println("Connecting to sntp server");
    while (!getLocalTime(&timeinfo)) {Serial.print(".");} // Pontosidő lekérése
    setTime(&timeinfo); // A DS3231 RTC beállítása
    Serial.println(" NTP connected");
    Serial.println(&timeinfo, "NTP time: %A, %B %d %Y %H:%M:%S");
    }*/
    ```

    By cool !

  • olli

    tag

    válasz olli #20145 üzenetére

    Eddig adatok küldését-fogadását láttam esp32-vel, műveletek végzését közvetlenül nem.

    By cool !

  • olli

    tag

    válasz Aryes #20148 üzenetére

    A legelső kód LoRa32u4 vevőre írva, az utóbbi saját és példa kódokból HeltecWiFi_esp32_oled küldő lapra. A Heltec vezérel reléket, de felmerült mint feladat a fogadó esp32-őn keresztül más relé kapcsolása is. Ennek a programozását kerestem.

    By cool !

  • olli

    tag

    válasz Aryes #20233 üzenetére

    A képen látható beállításokkal írva lett egy nano, sajnos az usb nem működik rajta.
    Egy kérdés maradt, a fuse bitek nem nullák elvileg, a felírás csak így sikerül.
    A nano unosítása réggebben sikerült, most is az lenne a cél.

    By cool !

  • olli

    tag

    válasz ekkold #20236 üzenetére

    nano:
    Sketch uses 2652 bytes (8%) of program storage space. Maximum is 30720 bytes.
    Global variables use 462 bytes (22%) of dynamic memory, leaving 1586 bytes for local variables. Maximum is 2048 bytes.
    uno:
    Sketch uses 2652 bytes (8%) of program storage space. Maximum is 32256 bytes.
    Global variables use 462 bytes (22%) of dynamic memory, leaving 1586 bytes for local variables. Maximum is 2048 bytes.
    Több hely a program számára.

    By cool !

  • olli

    tag

    válasz Aryes #20240 üzenetére

    avrdude.exe: reading input file "0x00"
    avrdude.exe: writing lfuse (1 bytes):
    Writing | ################################################## | 100% 0.02s
    avrdude.exe: 1 bytes of lfuse written
    avrdude.exe: verifying lfuse memory against 0x00:
    Reading | ################################################## | 100% 0.02s
    Na ezt a részt nem értem.
    Bepipáltam az írást, csak 0x00 beállítással fut le.
    Nem írható felül, milyen filet kellene írni?

    By cool !

  • olli

    tag

    Mit kellene változtatni a kódban a state helyes funkcióhoz?
    ```cpp
    #include <SPI.h>
    #include <LoRa.h>
    unsigned int state;
    //LoRa32u4 ports
    #define SS 8
    #define RST 4
    #define DI0 7
    #define BAND 433E6
    void setup() {
    Serial.begin(115200);

    pinMode(13, OUTPUT); // fehér led sets the pin as output for relay
    digitalWrite(13,HIGH);
    //while (!Serial); //if just the the basic function, must connect to a computer
    delay(1000);

    SPI.begin();
    LoRa.setPins(SS,RST,DI0);
    Serial.println("LoRa Receiver");

    if (!LoRa.begin(433E6)) {
    Serial.println("Starting LoRa failed!");
    while (1);
    }
    Serial.println("LoRa Initial OK!");
    }
    /*----( LOOP: RUNS CONSTANTLY )----*/
    void loop() {
    digitalWrite(13,LOW);
    // try to parse packet
    int packetSize = LoRa.parsePacket();
    if (packetSize) {
    // received a packet
    Serial.print("Received packet :");
    // read packet
    while (LoRa.available()) {
    Serial.print((char)LoRa.read());
    }
    // print RSSI of packet
    Serial.print("' with RSSI ");
    Serial.println(LoRa.packetRssi());

    if (state == 0) //Melegvíz gázkazánból..
    {
    Serial.println("GAZ_KAZAN - TIMER ON");
    digitalWrite(13,LOW); //Időzítés be..
    delay(500);
    }
    if (state == 1); //Melegvíz boilerből..
    {
    Serial.println("BOILER");
    digitalWrite(13,HIGH); //Időzítő ki..
    delay(3000);
    }
    }
    }
    //Serial print
    // Received packet :1 HELLO 34.25 17.00 7056' with RSSI -79
    //GAZ_KAZAN - TIMER ON
    //BOILER

    ```

    By cool !

  • olli

    tag

    válasz weiss #20275 üzenetére

    A pacet-ben 1-est kap elöl, ekkor a melegvíz a boilerből jön, ezt kell kiírnia: BOILER és a ledet HIGH-ra állítani.
    Most viszont vagy nem veszi figyelembe a packetet és 0-át ad state értéknek és kiírja: GAZ_KAZAN - TIMER ON
    aztán BOILER

    By cool !

  • olli

    tag

    válasz weiss #20278 üzenetére

    LoRa32u4 mint vevő.
    A kapott packet: 1 HELLO 34.25 17.00 7056' with RSSI -79
    Az első szám a state, állapota 0 vagy 1, serial print után kellene az állapotnak megfelelő led ill. print utasításnak lefutnia.

    By cool !

  • olli

    tag

    HELTEC WiFi LoRA 32 V2 OLED DISPLAY
    Folyamatos használatban mennyire stabil?
    Nálam ~ egy havi üzem alatt 3-4 esetben leállt a program futása relé kapcsolással járó funkcióban.
    Hasonló előfordult Nano lappal is, lehet ez is érzékeny a kapcsolási interferenciára?

    By cool !

  • olli

    tag

    válasz Aryes #20389 üzenetére

    [link]
    A relé a lapról kap 5V-ot és vezérlést, 230V-ot kapcsolgat egy zónaszelepen.
    Egy táp van a laphoz.

    [ Szerkesztve ]

    By cool !

  • olli

    tag

    válasz Aryes #20392 üzenetére

    Megnézem.
    A Nano alaplapos fűtésvezérlésnél külön táp van, ssr relék, a szivattyúk és irányváltó szelepek 230V-osak.
    Üzem közben, ami már régebben történt, szintén lefagyott a lap automata üzemben.
    Amióta csak fut a program, de nincs 230V kapcsolás nem volt lefagyás.

    By cool !

  • olli

    tag

    loRa sender codban:
     sensors.requestTemperatures();
     float T1 = sensors.getTempC(D0);
     float T2 = sensors.getTempC(D1);
       Serial.print("Sending packet: ");
      Serial.println(counter); 
       // send packet
      LoRa.beginPacket();
      LoRa.print(state);
      LoRa.print("  ");
      LoRa.print("HELLO");
      LoRa.print(T1 );
      LoRa.print("  " );
      LoRa.print(T2 );
      LoRa.print("  ");
      LoRa.print(counter);
      LoRa.endPacket();
      counter++;
    ESP32u4 receiver codban:
      // try to parse packet
      int packetSize = LoRa.parsePacket();
      if (packetSize) {
      // received a packet
        Serial.print("Received packet :");
      // read packet
        while (LoRa.available()) {
          Serial.print((char)LoRa.read());
      } 
          // print RSSI of packet
        Serial.print("' with RSSI ");
        Serial.println(LoRa.packetRssi()); 


    A packetből hogyan lehet a state értékét kinyerni?

    By cool !

  • olli

    tag

    válasz Janos250 #20453 üzenetére

         // try to parse packet
      int packetSizeMax = LoRa.parsePacket(); 
    if (packetSizeMax) {
    uint8_t inChar[packetSizeMax] ;
        uint8_t i = 0 ;
        while (LoRa.available()) {
          inChar[i] = ((char)LoRa.read()); 
          Serial.print((char)inChar[i]);
            i++ ;
         Serial.print((char)LoRa.read());
        }
    }
    Így megfelel?

    By cool !

  • olli

    tag

    válasz vargalex #20455 üzenetére

    Pontosan, az csomag első karaktere a state, a 0 vagy 1 értéket szeretném visszanyerni relé vezérléshez.
    Lehet inkább az ESP-NOW vonalon kellene elindulnom?

    By cool !

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