I am using the EasyNextionLibrary in my GIGA board. There is a problem and I still can't solve it.
I connect Arduino GiGA to the computer via Type C. Data is transmitted properly to the Nextion display. However, we remove the Type C cable and when we run the display and GIGA through the PCB board we designed, the data freezes and is not transmitted. Could this be due to Serial numbering in GIGA? Connected to Nextion TX2 and RX2. Therefore, it is initialized as Serial3.begin(9600). However, when I remove the Type C cable, data is not transmitted when RX and TX, that is, Serial.begin, are disabled. What could be the reason for this?
The lines of code are as follows...
#include "EasyNextionLibrary.h" // Include EasyNextionLibrary
EasyNex myNex(Serial3); // Giga'daki RX2 TX2 pinine bağlı. 17(RX2), 16(TX2) --> Serial3
String duman_okunan=""; // String türünde bir adet değişken tanımlanıyor
int duman = A0; // analog pin 0 MQ2 yi okuyor
#include "RPC.h"
void setup() {
RPC.begin();
myNex.begin(9600);
//M7 işlemcide hizDeger fonksiyonunu bağlıyoruz.
RPC.bind("hizDeger", hizDeger);
myNex.writeStr("page page0");
Serial.begin(9600);
}
void loop() {
//Duman Sensörü okuma ve Nextion HMI Ekrana Yazdırma
myNex.writeNum("dumanN.val", duman_oku());
Serial.println(duman_oku());
String hizSon = "";
while (RPC.available()) {
hizSon += (char)RPC.read(); // Fill the buffer with characters
}
if (hizSon.length() > 0) {
//Serial.print(hizSon);
int hizYazdir = hizSon.toInt();
myNex.writeNum("km.val", hizYazdir); //Nextion'a hızın verisini gönderiyoruz.
delay(10);
}
int hizDeger(int hiz) {
delay(3);
return hiz;
}
double duman_oku() //Duman sensörü için fonksiyon tanımladık
{
double duman_bilgi = analogRead(duman);
return duman_bilgi;
}