I have this code but i always get this error ('U8G2_ST7567_PI_128X64_1_4W_SW_SPI' does not name a type), i assume it is related to the name given to the device on the coding:
#include <U8g2lib.h>
// Initialize the U8g2 display object
U8G2_ST7567_PI_128X64_1_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 24, /* data=*/ 23, /* cs=*/ 15, /* dc=*/ 17, /* reset=*/ 18);
void setup() {
// Initialize the display
u8g2.begin();
}
void loop() {
// Clear the display
u8g2.clearBuffer();
// Set the font to use for the text
u8g2.setFont(u8g2_font_ncenB08_tr);
// Draw the text "Hello, world!" at position (0, 20)
u8g2.drawStr(0, 20, "Hello, world!");
// Send the buffer to the display to update it
u8g2.sendBuffer();
// Delay for a short period of time to slow down the display
delay(1000);
}
i found a library that allegedly works with this screen, but i cant declare it correctly, always gives the error: fatal error: ST7567S_128X64_I2C.c: No such file or directory #include <ST7567S_128X64_I2C.c>
^~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
exit status 1
Compilation error: ST7567S_128X64_I2C.c: No such file or directory
Your include is obviously wrong. First - '.c' files never used in includes. Second - most like it should be something like 'u8glib.h
Please insert link to the library you tried to use?
hello, thanks for your reply, i have been working further, im trying to use U8g2lib at the moment, when im compiling the code it just gets stuck on a infinite load, and doesn't even give a error message, about my last question, i tried with the .h in the include got the same result the link is GitHub - luetee/ST7567S_128X64_I2C: LCD ST7567S 128X64 I2C Arduio UNO.
the code that is stuck on infinite compilation:
void setup() {
// put your setup code here, to run once:
#include <U8g2lib.h>
#include <Wire.h>
// Inicialize o objeto U8G2 com o controlador ST7567 e a interface I2C
U8G2_ST7567_64X32_1_4W_SW_I2C u8g2(U8G2_R0, /* reset=*/ U8X8_PIN_NONE);
void setup() {
// Inicialize a comunicação I2C
Wire.begin();
// Inicialize o display
u8g2.begin();
}
void loop() {
// Limpa o buffer do display
u8g2.clearBuffer();
// Define a fonte a ser utilizada
u8g2.setFont(u8g2_font_ncenB14_tr);
// Escreve "Hello World!" no display
u8g2.drawStr(0, 20, "Hello World!");
// Envia o buffer para o display
u8g2.sendBuffer();
// Aguarda um segundo
delay(1000);
}
}