I have a project that is using the Arduino Uno (an 'authentic' one) and it's pretty close to filling up the program space, so I bought a MEGA2560 (from Elegoo) to continue forward with, thinking that they were compatible in my case.
I made a small breakout PCB that takes the GPIO pins and puts them onto a header for an LCD display.
When I run the code on the Uno, everything works as expected. When I run that same code on the MEGA2560, the screen is just full of random characters, some of which blink(?).
Here is some pared down code that demonstrates the issue. Can someone here help me identify what the issue is? Is there some GPIO difference between these boards that I'm missing?
#include <Arduino.h>
#include <U8g2lib.h>
//////////////////////////////////
// LCD Data and Control lines
const int lcd_d0 = 14; // analog pin A0, digital pin 14
const int lcd_d1 = 15; // analog pin A1, digital pin 15
const int lcd_d2 = 16; // analog pin A2, digital pin 16
const int lcd_d3 = 17; // analog pin A3, digital pin 17
const int lcd_d4 = 0; // digital pin 0
const int lcd_d5 = 1; // digital pin 1
const int lcd_d6 = 2; // digital pin 2
const int lcd_d7 = 9; // digital pin 9
const int lcd_enable = 10; // digital pin 10 LCD: /CE, pin 7
const int lcd_cs = 11; // digital pin 11 LCD:
const int lcd_dc = 12; // digital pin 12 LCD: C/D, pin 8
const int lcd_reset = 13; // digital pin 13
//////////////////////////////////
/* Constructor */
//https://github.com/olikraus/u8g2/wiki/u8g2setupcpp#t6963-240x64
U8G2_T6963_240X64_2_8080 u8g2(U8G2_R0, lcd_d0, lcd_d1, lcd_d2, lcd_d3, lcd_d4, lcd_d5, lcd_d6, lcd_d7, lcd_enable, lcd_cs, lcd_dc, lcd_reset); //[page buffer, size = 240 bytes]
void setup() {
//put your setup code here, to run once:
u8g2.begin();
}
void loop() {
// put your main code here, to run repeatedly:
u8g2.firstPage();
do {
u8g2.setFont(u8g2_font_9x15B_tf);
u8g2.drawStr(0,10,"Testing 123....");
} while ( u8g2.nextPage() );
delay(1000);
}