Hello
I have the following setup:
Arduino Mega 2560
Display: KXM12864J-4 (datasheet seems correct at https://www.buyhere22.com/components/kxm12864j-4.pdf)
The following test program gives a white screen.
I have tried to follow all three modes in setup_tutorial · olikraus/u8g2 Wiki · GitHub
(full buffer, page buffer and 8x8 mode). All give the same result, which seem to be all pixels painted "white".
I have tried adjusting contrast (2k and 8k ohm with a potentiometer) without success.
I can not get this to work. Is my display broken or am I doing something wrong?
The code below shows how I have the display connected. Besides this, I have these pins connected
Display - Arduino
1 - GND (below pin 53)
2 - 5V (above pin 23)
3 - Connected to 2k ohm and then to display pin 18 AND to 8k ohm and then to GND
4 through 17 as in code below
18 - Connected to 3 via 2k ohm and to GND via effectively 10k ohm
19 - 5V (and thus to display pin 2)
20 - GND (and thus to display pin 1)
#include <Arduino.h>
#include <SPI.h>
#include <U8g2lib.h>
#include <U8x8lib.h>
#include <Wire.h>
#define PIN_DC 22 //RS
#define PIN_ENABLE 23
#define PIN_D0 24
#define PIN_D1 25
#define PIN_D2 26
#define PIN_D3 27
#define PIN_D4 28
#define PIN_D5 29
#define PIN_D6 30
#define PIN_D7 31
#define PIN_CS0 34
#define PIN_CS1 35
#define PIN_CS2 U8X8_PIN_NONE
#define PIN_RESET 36
#define ROTATION U8G2_R0
U8G2_KS0108_128X64_1 u8g2(ROTATION, PIN_D0, PIN_D1, PIN_D2, PIN_D3, PIN_D4, PIN_D5, PIN_D6, PIN_D7, PIN_ENABLE, PIN_DC, PIN_CS0, PIN_CS1, PIN_CS2, PIN_RESET);
void setup() {
u8g2.begin();
}
void loop() {
u8g2.firstPage();
do {
u8g2.setFont(u8g2_font_ncenB14_tr);
u8g2.drawStr(1, 15, "Hello World!");
} while ( u8g2.nextPage() );
delay(1000);
}
Maybe worth mentioning that my arduino is powered by a 12V power supply and should have sufficient power.
The display backlight lights up the whole room and the neighbors yard and almost the dark side of the moon.
There seem to be no lack of juice.