Hello Guys, I’am new in the Arduino programming and have a problem.
Sorry my English is not so good
I am use an Graphic Display ST7920 128x64 (from Amazon) the basicly programming is not the problem but i think I have a hardware timing problem.
Sporadically / often are some pixel are horizontal shift. see the Pictures in the attachement.
My Hardware Setup
- Arduino Mega 2560 (Clone)
- Grafik Display ST7920 128x64 on SPI
- MAX31865 for PT100
- Build on Breadborad
- Library = U8G2
How or where can I change the delay for the write timing ?
I have search in the Library but I haven’t found die section
What are meaningful Value ?
Thanks a lot for your support.
Here are the Code:
#include <Adafruit_MAX31865.h>
#include <Arduino.h>
#include <U8g2lib.h>
#ifdef U8X8_HAVE_HW_SPI
#include <SPI.h>
#endif
#ifdef U8X8_HAVE_HW_I2C
#include <Wire.h>
#endif
//Pins for MAX31865
const int MAX_CS = 53;
const int MAX_CLK = 52;
const int MAX_SDI = 51;
const int MAX_SDO = 50;
//Referenz Widerstand (gemessen) auf der MAX31865
#define RREF 424.0
//Pins for LCD
const int LCD_CLK =13;
const int LCD_DATA = 11;
const int LCD_CS = 10;
const int LCD_RESET = 8;
//
char StrTemp [5];
// Use software SPI for MAX31865
Adafruit_MAX31865 max = Adafruit_MAX31865(MAX_CS, MAX_SDI, MAX_SDO, MAX_CLK);
// Use software SPI for ST7920
U8G2_ST7920_128X64_1_SW_SPI u8g2(U8G2_R0,LCD_CLK,LCD_DATA,LCD_CS,LCD_RESET);
void setup() {
// put your setup code here, to run once:
max.begin(MAX31865_4WIRE);
u8g2.begin();
u8g2_prepare();
}
void u8g2_prepare(void){
u8g2.enableUTF8Print();
u8g2.setFont(u8g2_font_helvB10_tf);
//u8g2.setFont(u8g2_font_6x10_tf);
u8g2.setFontRefHeightExtendedText();
u8g2.setDrawColor(1);
u8g2.setFontPosTop();
u8g2.setFontDirection(0);
}
void printValue(void){
//Read Temeratur
float Temp = max.temperature(100, RREF);
//Convert float to String
dtostrf(Temp,3,1,StrTemp);
//Tries
//Display bereinigen
//u8g2.begin();
//u8g2.clearDisplay();
//u8g2_prepare();
//Print static text
u8g2.drawStr(10,13,"Lufttemperatur");
u8g2.drawUTF8(70,30,"°");
u8g2.drawUTF8(76,30,"C");
//Print Values
u8g2.drawStr(35,30,StrTemp);
}
void loop() {
u8g2.firstPage();
do{
printValue();
}while (u8g2.nextPage());
delay(1); //For test 1-1000 tried
}