Nextion Display LED On Off with Dual State Button & Image

แชร์
ฝัง
  • เผยแพร่เมื่อ 10 เม.ย. 2020
  • Nextion HMI displays are getting popular in Industrial panel control applications.
    This video explains the usage of Double State Button on Nextion Editor to control an LED with attractive images on display.
    On Nextion editor there is an option of EVENT Window where you can write some simple code for button Touch or Release Events.
    Download Arduino code & images :
    www.alselectro.com/files/NEXTI...
    Note : Try download link on Microsoft Edge or Firefox bowser , if link doesn't work on Chrome
  • แนวปฏิบัติและการใช้ชีวิต

ความคิดเห็น • 52

  • @ahmadhumadi3153
    @ahmadhumadi3153 ปีที่แล้ว +2

    Thank you for your efforts, we'll explained and demonstrated, greatly appreciated 🙏

  • @joescopo8933
    @joescopo8933 ปีที่แล้ว

    Great video! I can now use a duel state button on my project. Thank you!

  • @itsme.6863
    @itsme.6863 2 ปีที่แล้ว

    I learned something, so I clicked thumps-up. Thanks.

  • @imextradeco.6689
    @imextradeco.6689 3 ปีที่แล้ว

    Thank you for the easy-to-understand Tutorial. I have something to ask you. Could you give me any good ideas? My goal is to display the Arduino EEPROM stored values in a box (x0.val) on a particular page. I'm stumbling right now, I don't know how to get the page ID currently displayed on the TFT screen. Could you please teach me?

  • @electronic7979
    @electronic7979 4 ปีที่แล้ว +1

    Nice project. Very good

  • @donaldwright2426
    @donaldwright2426 4 ปีที่แล้ว

    I'm using your example code to stop and start a pulse motor that the Arduino MEGA runs. Your code is simple as Panali mentionned. Eventually it will be a 3phases PMSM... Just learning right now!

  • @chain3519
    @chain3519 2 ปีที่แล้ว

    Let me go ahead and leave a like for this straightforward tutorial

  • @pch4287
    @pch4287 2 ปีที่แล้ว

    Very helpfull video.Thank you

  • @surenderkumar-yi1ig
    @surenderkumar-yi1ig ปีที่แล้ว

    Very useful video thank you sir

  • @Tecnotronics223
    @Tecnotronics223 2 ปีที่แล้ว

    Very very nice.... Regards to you 👍

  • @kamilzdunczyk2245
    @kamilzdunczyk2245 3 ปีที่แล้ว

    nice example
    but what should I do if I want to have similar such buttons??

  • @advancedperformance9721
    @advancedperformance9721 3 ปีที่แล้ว

    Thanks alot sir

  • @rockrock4478
    @rockrock4478 7 หลายเดือนก่อน

    How to add one or two more buttons to a sketch, please?

  • @user-op4dd8ey8j
    @user-op4dd8ey8j 3 หลายเดือนก่อน

    i have on situation.... i using two page. in the 2 page i use the dual state button. if i change the state of the button from OFF to ON and back to the page 1, when i back again to the page 2, the button state is not keep the state, button state is off. why?

  • @pravado81
    @pravado81 3 ปีที่แล้ว

    The coding that is used in the editor. What language is it?

  • @adnanyounus6192
    @adnanyounus6192 ปีที่แล้ว

    Hello Sir,
    Hope you are doing well.
    Please let me know is it possible to proceed same project with Raspberry Pi Pico ?
    If yes please make a toturial on it.
    Thanks

  • @bugkuska
    @bugkuska ปีที่แล้ว

    do you have example use more than 1 button?

  • @Microsree28134
    @Microsree28134 3 ปีที่แล้ว

    Sir,
    Please make a video on Nextion display sleep and wake mode

  • @Microsree28134
    @Microsree28134 3 ปีที่แล้ว

    Whu did yo put ") " in else if statement..?

  • @Counterpoint69
    @Counterpoint69 ปีที่แล้ว

    😮Hello. Your code works well for one dual state switch. However it won’t work for multiple dual state switches on one page or dual state switches on several pages. I’ve tried the following code on an Arduino 2560 but it doesn’t turn on the built-in LED on the Arduino board (pin 13). I'm using a dual state button with this. Any help would be appreciated.
    #include "Nextion.h"
    int ledPin = 13;
    NexDSButton bt0 = NexDSButton(2, 9, "bt0");
    uint32_t dual_state=0;
    void setup(void){
    nexInit();
    pinMode(ledPin, OUTPUT);
    }
    void loop(void){
    bt0.getValue(&dual_state);
    delay(200);
    if(dual_state==1)
    {
    digitalWrite(ledPin, HIGH);
    }
    else if(dual_state==0)
    {
    digitalWrite(ledPin, LOW);
    }
    }

  • @palanik1960
    @palanik1960 4 ปีที่แล้ว

    Excellent and simple.
    Good product demo.Can you please extend the project for practical application like home device control or as security application.

    • @donaldwright2426
      @donaldwright2426 4 ปีที่แล้ว

      I use it to show the RPM, frequency of a pulse motor. Also instaured a dual button to start and stop the pulse motor. The pulse motor was in part 3D printed and salvage a relay coil that I modified to adapt as a stator coil to my 3D pulse motor.
      Regards.

    • @nicolasyesidriveralesmes6277
      @nicolasyesidriveralesmes6277 3 ปีที่แล้ว

      I used it to make a "dark mode" switch for my wather station project. The limits are in your imagination.

  • @user-eb3fe3yv1s
    @user-eb3fe3yv1s 7 หลายเดือนก่อน

    А у нас выключатели включаются в верх а в низ выключаются.

  • @elizetebezerra3391
    @elizetebezerra3391 9 หลายเดือนก่อน

    Comprei um celular,já faz 1mês e não chegou,e me cobraram também 77 90não sei de que

  • @mouseminer2978
    @mouseminer2978 3 ปีที่แล้ว

    Very nice. What if I have two switches. How Arduino is going to distinguish, which is on and which is off.

    • @rachelchow4512
      @rachelchow4512 3 ปีที่แล้ว +1

      Hi will you consider to look at the DWIN display?kindly send me an email or message referring to my banner contact info.

  • @MrDelta830
    @MrDelta830 3 ปีที่แล้ว

    Morning sir AL, with Nexion software it's possible to dowload a project from display to computer for make some modifications ? Example text, color, ecc. Thanks

    • @rachelchow4512
      @rachelchow4512 3 ปีที่แล้ว

      Hi will you consider to look at the DWIN display?kindly send me an email or message referring to my banner contact info.

  • @pablosaizortuno4740
    @pablosaizortuno4740 3 ปีที่แล้ว

    It is possible to do it without the screen? I mean, just from the debug mode simulation, connecting the computer to the Arduino

    • @chain3519
      @chain3519 2 ปีที่แล้ว

      Probably not helpful to you now, but in the debug panel there's an option in the bottom left corner called User MCU input. This brings up a COM port selector tool. From there I'm sure you could hook in an arduino or even just simulate an arduino using PUTTY

  • @muhammadazka1868
    @muhammadazka1868 2 ปีที่แล้ว

    hello sir , i love your videos. but can you make a program similar to this but using software serial instead of rx tx in the arduino?? that would be more helpfull thanks :)

    • @BlondieSL
      @BlondieSL ปีที่แล้ว

      I know that your comment is over a year old and you've probably figured it out, but for those who don't know, the answer is YES!
      When I was using Nextion on a regular Nano, I had to use Software Serial and set up the 2 pins I wanted to use for RX and TX. I would make that Serial2.
      But here's the thing, if you are using say, a Nano Every board, it already has 2 serial ports on it (maybe it's 3, I forget). So you don't even need to use Software Serial. By using hardware serial, it's much faster too.
      However, consider moving to ESP32! I just did recently and now kick myself for not doing so long ago.
      So much more memory. So much faster. Dual cores an yes, you can code using Arduino IDE and use both cores!! Nextion works perfectly on the ESP32, *HOWEVER, YOU MAY NEED TO USE LOGIC LEVEL CONVERTER* because the ESP32's logic voltage is 3.2V while Nextion's logic voltage is 5V.
      Sometimes it just works, but as I ran into, sometimes it does not. ON the project I'm working on now, I had to use the logic level converter, which is super cheap and easy to connect.
      Hope that helps.

  • @STMONDEO1
    @STMONDEO1 4 ปีที่แล้ว

    Pete.
    Hi Saravanan.
    i am new to this Arduino Program.
    Trying to run your code but keep getting error message ( EXPECTED INITIALIZER BEFORE NUMERIC CONSTANT )

    • @kamilzdunczyk2245
      @kamilzdunczyk2245 3 ปีที่แล้ว +2

      let me know if it works
      #define SWITCH_ON 1
      #define SWITCH_OFF 0
      const int led = 12;
      byte received_data[4];
      int switch_pos;
      void setup() {
      // put your setup code here, to run once:
      Serial.begin(9600);
      Serial.println("ready");
      pinMode(led,OUTPUT);
      digitalWrite(led, LOW);
      }
      void loop() {
      // put your main code here, to run repeatedly:
      int i;
      while (Serial.available() > 0) {
      switch_control();
      }
      }
      void switch_control() {
      int size = Serial.readBytesUntil('
      ', received_data, 4);
      // First Byte has the switch position data
      switch_pos = received_data[0];
      Serial.print("SWITCH:");
      if (switch_pos == SWITCH_ON) {
      Serial.println("ON");
      digitalWrite(led, HIGH);
      } else if (switch_pos == SWITCH_OFF) {
      Serial.println("OFF");
      digitalWrite(led, LOW);
      }
      }

    • @arebelfromhell
      @arebelfromhell ปีที่แล้ว

      Did you ever figure this out Pete?

  • @STMONDEO1
    @STMONDEO1 4 ปีที่แล้ว

    Hi can not get to UPLOAD to my Arduino UNO.
    Can anybody help with this project.
    Thanks

    • @kamilzdunczyk2245
      @kamilzdunczyk2245 3 ปีที่แล้ว

      you have the answer in the post below.
      let me know if it works

  • @chandrapurnama6777
    @chandrapurnama6777 ปีที่แล้ว

    i nned link driver ch340

  • @federicoferrara125
    @federicoferrara125 3 ปีที่แล้ว +1

    Good evening, excellent project but this error appears to me:
    print bt0.val
    if bt0.val == 1
    {
    t0.txt = "LED ON"}
    else if (bt0.val == 0)
    {
    t0.txt = "LED OFF"}
    SYNTAX ERROR :EXTRA "{{( appears. Can you tell me what to do thanks

    • @federicoferrara125
      @federicoferrara125 3 ปีที่แล้ว

      Signor Savaranan,gentilmente puo' rispondere alla mia domanda?.Grazie

  • @michaelnessim
    @michaelnessim 2 ปีที่แล้ว

    link is down

  • @badusha_ali_
    @badusha_ali_ ปีที่แล้ว

    sir nextion or dwin is better display

    • @BlondieSL
      @BlondieSL ปีที่แล้ว

      I'd say Nextion since it's so much more supported by users like me and Saravana (and many others).
      The editors are insanely amazing.
      What you saw here was a very minor use of the device. There's so much more that you can do.
      In all my projects, I put a lot of code into the display itself to let it do as much of the work, releasing Arduino or ESP32 to do less work.
      By coding inside the display itself, for many things, you can have your controller (Arduino or ESP32) having to only send the bare minimum data... often, just a flag here and there... of course, depending on what you are doing.
      You can search YT for "Nextion without libraries" and learn how to do, literally everything you need to do, without using any libraries at all. It's a major memory saver, because the Nextion libraries are just BLOATED beyond belief! You'll even learn how to send and receive from/to Nextion!
      Hope that helps.

  • @forkus2000
    @forkus2000 3 ปีที่แล้ว

    But this is a very bad solution , because you never send the id of the button to the microproccessor , whath happens if you have two buttons ? how can you detect from wich button send the command? do the same with 3 buttons ... and you see what i talking about....Thanks

    • @jokkiossaka3306
      @jokkiossaka3306 3 ปีที่แล้ว

      No problem, every button have other ID...

    • @kritsadaonkhong3148
      @kritsadaonkhong3148 3 ปีที่แล้ว

      Hello, I ran into this problem. I don't know how to fix the problem.

    • @kritsadaonkhong3148
      @kritsadaonkhong3148 3 ปีที่แล้ว

      @@jokkiossaka3306 help me

    • @rachelchow4512
      @rachelchow4512 3 ปีที่แล้ว

      @@kritsadaonkhong3148 Hi will you consider to look at the DWIN display?kindly send me an email or message referring to my banner contact info.

  • @daryl7237
    @daryl7237 ปีที่แล้ว

    Hi there! i really like all your Nextion display video thank you ! it really help on some of my project, is there any way that i can message u when i face any coding problem? email