Start a new topic

Nextion Touch without Nextion.h

Hello, 


can someone tell me how to read without nextion.h library 

float getValue;
int value;
int value1;
int value2;
int value3;
float oldvalue;

String a;

void setup() {
  Serial.begin(9600);
}

void loop() 
{
    getValue = analogRead(A0);
  
    if (getValue==oldvalue)
      {;}
    else
    { 
        oldvalue=getValue;
        getValue=(getValue*100/1023);
        value=getValue;
        value1=50;
        value3=100;
  
        Serial.print("j0.val=");
        Serial.print(value);
        Serial.write(0xff);
        Serial.write(0xff);
        Serial.write(0xff);

        Serial.print("j1.val=");
        Serial.print(value1);
        Serial.write(0xff);
        Serial.write(0xff);
        Serial.write(0xff);

        Serial.print("j2.val=");
        Serial.print(100);
        Serial.write(0xff);
        Serial.write(0xff);
        Serial.write(0xff);

        Serial.print("j3.val=");
        Serial.print(value3);
        Serial.write(0xff);
        Serial.write(0xff);
        Serial.write(0xff);
  
        Serial.print("n0.val=");
        Serial.print(analogRead(A0));
        Serial.write(0xff);
        Serial.write(0xff);
        Serial.write(0xff);
        }

        while (Serial.available() > 0) 
        {
          a += char(Serial.read());
          delay(2);
        }

        Serial.print("t0.txt=");
        Serial.print(a);
        /*
        if (Serial.available ()> 1) 
        {
          if (charflag)  
          {
            char2=Serial.read ();
            if (char2 == 0) digitalWrite (13, HIGH);
            else if (char2 == 0x01) digitalWrite (13, LOW);
            charflag=0;
          }
          else
          {
            char1=Serial.read ();
            if (char1 == 0x65) charflag=1;
          }
        }
        */
  delay(100);
}



/*
void readDataSimple () 
{
 int array[16];
  while (Serial.available() > 0) {
    for (int i = 1 ; i < 16; i++) {
      array[i] =  Serial.read();
      Serial.println(array[i]);
      delay(20);
    }
    array[16] = '\0';
    int pageNumber = array[2];
    int componentNumber = array[3];
    int pressEvent = array[4];
    int numericalData = array[9];
    Serial.print("pageNumber: ");
    Serial.println(pageNumber);
    Serial.print("componentNumber: ");
    Serial.println(componentNumber);
    Serial.print("pressEvent: ");
    Serial.println(pressEvent);
    Serial.print("numericalData: ");
    Serial.println(numericalData);
    Serial.print("numericalData: ");
    Serial.println(numericalData);
    Serial.print("t0.txt=");
    Serial.write(0x22);
    Serial.print(array[16]);
    Serial.write(0x22);
    Serial.write(0xff);
    Serial.write(0xff);
    Serial.write(0xff); 
  }
}
*/

 



 Try something like:

Serial.print("get variableName.txt")
Serial.write(0xFF);
Serial.write(0xFF);
Serial.write(0xFF);
while (!Serial.available()) {}
char result[64]{0};
while (Serial.available()) {
  byte c = Serial.read();
  if (c < 0x80) {
    result[p++] = c;
  }
}

 

I am now reviewing all of the Feature Requests, this will take some time, patience please.

Although this wasn't a real feature request, it is now marked as reviewed.

Future questions should be posted to the Free Chat Section

Login or Signup to post a comment