123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 |
-
-
-
-
-
-
-
- #include "EasyNextionLibrary.h"
- EasyNex myNex(Serial);
-
- void setup(){
- myNex.begin(9600);
-
-
- pinMode(LED_BUILTIN, OUTPUT);
- digitalWrite(LED_BUILTIN, HIGH);
- }
- void loop(){
- myNex.NextionListen();
-
- }
- void trigger0(){
-
-
-
- digitalWrite(LED_BUILTIN, !digitalRead(LED_BUILTIN));
- if(digitalRead(LED_BUILTIN) == LOW){
- myNex.writeNum("b0.bco", 2016);
- myNex.writeStr("b0.txt", "ON");
- myNex.writeNum("p0.pic", 1);
-
- }else if(digitalRead(LED_BUILTIN) == HIGH){
- myNex.writeNum("b0.bco", 63488);
- myNex.writeStr("b0.txt", "OFF");
- myNex.writeNum("p0.pic", 0);
- }
- }
- void trigger1(){
-
-
-
-
- if(digitalRead(LED_BUILTIN) == LOW){
- digitalWrite(LED_BUILTIN, HIGH);
- myNex.writeNum("b0.bco", 63488);
- myNex.writeStr("b0.txt", "OFF");
- myNex.writeNum("p0.pic", 0);
- }
-
- myNex.writeStr("t0.txt", "LED STROBE\\rON");
- for(int i = 0; i < 10; i++){
- for(int x = 0; x < 10; x++){
- digitalWrite(LED_BUILTIN, !digitalRead(LED_BUILTIN));
- delay(50);
- }
- digitalWrite(LED_BUILTIN, !digitalRead(LED_BUILTIN));
- delay(500);
- digitalWrite(LED_BUILTIN, !digitalRead(LED_BUILTIN));
- }
- myNex.writeStr("t0.txt", "LED STROBE\\rOFF");
-
-
-
-
- }
|