SMART GPU LCD display interfers with Analog Read on MEGA2560

Hello,

I am using the ARDUNIO MEGA2560 with SMART GPU2 LCD display. Here is my code.

#include <SMARTGPU2.h> //include the SMARTGPU2 library!

SMARTGPU2 lcd; //create our object called LCD

/////////////////////////// Analog read
int sensorPin = A0; // select the input pin for the potentiometer
int sensorValue = 0; // variable to store the value coming from the sensor
///

void setup() {

//Those two functions must always be called for SMARTGPU2 support
lcd.init(); //configure the serial and pinout of arduino board for SMARTGPU2 support
lcd.start(); //initialize the SMARTGPU2 processor
// end GPU2 Support

// COMMUNICATE WITH LCD DISPLAY
lcd.baudChange(BAUD6); // Set a fast baud!, always that we use touch functions is

}

void loop() {
int inChar;

AnalogMenu();

}

void AnalogMenu (void)
{

sensorValue = analogRead(sensorPin);

lcd.setTextColour(CYAN);
lcd.setTextSize(FONT2);
lcd.printNumber(10, 150, sensorValue);

}

The display always shows 1023. No matter what the Analog input is.
If I remove the Smart GPU2 LCD display and remove all the lines in the program that refers to it.
and then have the MEGA2560 to send out the data on the RS232, then I get the correct value.
There is a conflict somewhere but I can not find it.

Any Ideas would be appreciated.

Thanks

Bobby

#include <SMARTGPU2.h>     //include the SMARTGPU2 library!

Really? Are you SURE that that is what that statement does?

void loop() {
  int inChar;

      AnalogMenu();
     
}

What the hell is inChar for? Why the hell does the name not match the type?

Any Ideas would be appreciated.

Try the other analog pins. Post a link to the library and hardware.

Hello,

Yes it does. I have written programs using this LCD display many time with success. And it does need this line;

#include <SMARTGPU2.h> //include the SMARTGPU2 library!

This lines was copied from a sample program provided by the LCD manufacture.

The line showing the "int inChar;" Will be used for the rest of the program that I have not written yet.

I have tried other Analog Input channels with the same problem. The reading is always 1023.

Bobby

And it does need this line;

But, it does NOT need the useless comment.

The line showing the "int inChar;" Will be used for the rest of the program that I have not written yet.

And, with that name, the rest of the code won't make a damned bit of sense.

Hi bobby,

What you want to do exactly?Try to put lcd.baudChange(BAUD6) in the void loop.