St7735 display problem

Hello!I have a problem with my display.It is the st7735 160x80 pixels, 0,96 inch.I want to make a calibration device to calibrate some axes for my project.Throttle for planes.There are two axes there.I do not want to go through the problem of having to mechanically calibrate it, so i want to do it electronically.When i wanted to make an interface and just did a quick test, instead of displaying the value(the value range is from 0 to 100%) it just shows some insane looking symbols sometimes across the whole row(depending on the value).By the way i am using potentiometers for the axes.
Here is the code that i am using:

int pot = 0;
#include <UTFT.h>                                      
#include <Wire.h>                                      

 
extern uint8_t SmallFont[];                             
             
 
UTFT myGLCD(ST7735S_4L_80160,11,13,10,8,9);             
                                    
 
void setup()
{
 
  myGLCD.InitLCD();                                    
  myGLCD.setFont(SmallFont);                            
  pinMode(A0,INPUT);          
      myGLCD.clrScr();                                   
    myGLCD.fillScr(255, 0, 0);                           
  myGLCD.setColor(255, 0, 0);    
  Serial.begin(9600);                    
}
 
 
void loop()
{
Serial.println(pot);

int pot = analogRead(A0);

      myGLCD.setColor(255, 255, 255);              
                     
  myGLCD.print("CALIBRATION", CENTER, 5);                        
  myGLCD.setColor(0, 255, 0);
  myGLCD.setBackColor(255, 0, 0);
  myGLCD.print("thr 1:", 5, 20);
  myGLCD.print(pot, 6, 20);
  myGLCD.setColor(0, 0, 255);
  myGLCD.setBackColor(255, 0, 0);
  myGLCD.print("", CENTER, 57);
                
}

Don't know about your screen, but this line

is NOT updating your global variable pot but creating a local variable of the same name that doesn't retain the value with each call of loop(). It should be

pot = analogRead(A0);

It still isnt working.Ive tried a lot of different things but nothing seems to work.

Would you show a picture of the insane symbols? I think the symbols are just text over-writing itself.

Here is a simulation of your code (slightly modified):

I cant show you picture,but i can write some symbols not the exact same ones(because they are probably overlaping)but something close to them:
ﷺ this is arabic,but its something like this(just more pixelated).

What happens if instead you just print the index of a for loop?

What do you mean? Why would i put a for loop here? The problem is not reading the potentiometer value but making the display display the value on its screen.

To help you investigate your problem.

Maybe I've misunderstood something.

Your call.

(It's not a big thing but

isn't necessary)

Ok.So i have watched a video from learnelectronics where he showed how to get this display working.He used a sensor that could sense temperature, humidity and pressure.Then he used code similar to mine(I copied his code and just removed the sensor code and wrote some code to make the arduino read the potentiometer values) and it worked for him(he was reading the values from the sensor, while i am reading the values from the potentiometer).I think it has something to do with the display because when i open serial monitor it reads the values just fine.

And what happened when you replaced the potentiometer read with a simple for loop?

Did it fail at the same point every time?

What did learnelectronics have to say about this issue?

Learnelectronics did not cover this issue, and i dont really know what for loop.Can you write an example?

It seems Adafruit have two models (A and B) of the ST7735 that are pin-interface-wise the same, but require different code/sketch.

This page introduces the A versus B:

This page has the A and B code/sketch:

That doesnt look anything like mine.
My looks exactly like one in the learnelectronics video.

Thank you for showing your sketch. Show your device (front and back, which Arduino, et c). Show your wiring. Show your error.

I wired it like the datasheet(or the manual) says(and how learnelectronics wired it).

What datasheet?

My bad i mixed some things up.Yes, there is a datasheet but i dont think that the wiring diagram to connect it to arduino.The datasheet is not really important.

Right.
Got it.

1 Like

@azur123123

Heh, welll... the specific datasheet shows how the display works, or does not work, like when I mentioned a ST7735 that [looks nothing] like your ST7735... so, too, will be the information in the datasheet/specifications. I did a little reading. Your ST7735 wants 3v3, but some Arduino boards can not source the 3v3 power the display needs... then your video guy just hooked up the display to 5v - not recommended - and it "worked." So, go back through the help you have received, respond to their suggestions, and get the ST7735 working.

I did try it a 3.3 volts but it didnt work well it glitched, so i switched it to 5 volts and it worked but i still have the problem that i mentioned in the description.