Start a new topic

Progress bar- what am I missing

I am trying to replicate this same setup with the progress bar. But I must be missing something. Isn’t the TFT supossed to read what is comming from the Iteaduino. I downloaded the sketch and loaded the TFT , but the text is not changing with the pot. I am new to arduinos, so keep this in mind and do not assume I know how to do anything with this setup. Thanks,Richard

I am trying to replicate this same setup with the progress bar. 


Which setup do you refer to? Could you give a link?

 I am using the same setup as the video, an iteaduino UNO and the Nextion NX3224TO28 TFT touch screen and a potentiometer.


http://blog.iteadstudio.com/product-preview-nextion-in-an-arduino-project-2/

Do you use the Arduino code with or without Nextion library?

I used the longer version , not the library.

 

Download the sketch to your UNO without Nexiton display connetion.

After download the sketch,Comfirm your hardware connection is : 

Nextion   UNO

    TX  →  RX

    RX  → TX

    V    →  V

    G   →   G 

Potentiometer   UNO

        Signal   →  A0

          V       →   V

         G       →   G

Sketch: 

float getValue;
int value;
float oldvalue;

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

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

The HMI file download: http://wiki.iteadstudio.com/File:Progressbar.zip

 I had the serial connected wire to wire, forgot it needed to be Rx to TX.

The next problem is the txt that is displaying does not refresh , so you end up with a bunch of number on top of each other.


I used the code from Itead studio

I‘m puzzled. if you use the original HMI file and the sketch, it will work well.

Could you take a photo or print screen here?

I am not using original HMI. I created another HMI , and txt boxes to read trim pot using same setup as the progress bar HMI.

 

 See the code below:

 Serial.print("j0.val=");
  Serial.print(value);
  Serial.write(0xff);
  Serial.write(0xff);
  Serial.write(0xff);
  Serial.print("t0.txt=");
  Serial.write(0x22);
  Serial.print(value);
  Serial.write(0x22);
  Serial.write(0xff);
  Serial.write(0xff);
  Serial.write(0xff);

There are no relationship between  the progress bar component and the txt component.

I got the txt to work, I am not using the progress bar portion. For some reason the problem was caused when I set up a different text.

 

Login or Signup to post a comment