oled example won't upload

Hello,
I recently got an oled display and wanted to test it out so I grabbed some code from the u8x8 github page and uploaded it but I got this error:

C:\Users\benjc\AppData\Local\Temp\arduino_modified_sketch_75670\sketch_mar12a.ino: In function 'void setup()':
sketch_mar12a:4:3: error: 'u8x8' was not declared in this scope
   u8x8.begin();
   ^~~~
C:\Users\benjc\AppData\Local\Temp\arduino_modified_sketch_75670\sketch_mar12a.ino:4:3: note: suggested alternative: 'u8'
   u8x8.begin();
   ^~~~
   u8
C:\Users\benjc\AppData\Local\Temp\arduino_modified_sketch_75670\sketch_mar12a.ino: In function 'void loop()':
sketch_mar12a:8:3: error: 'u8x8' was not declared in this scope
   u8x8.setFont(u8x8_font_amstrad_cpc_extended_r);
   ^~~~
C:\Users\benjc\AppData\Local\Temp\arduino_modified_sketch_75670\sketch_mar12a.ino:8:3: note: suggested alternative: 'u8'
   u8x8.setFont(u8x8_font_amstrad_cpc_extended_r);
   ^~~~
   u8
sketch_mar12a:8:16: error: 'u8x8_font_amstrad_cpc_extended_r' was not declared in this scope
   u8x8.setFont(u8x8_font_amstrad_cpc_extended_r);
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Using library U8glib at version 1.19.1 in folder: C:\Users\benjc\OneDrive\Documents\Arduino\libraries\U8glib 
exit status 1
'u8x8' was not declared in this scope

this is the code:

#include <U8glib.h>

void setup(void) {
  u8x8.begin();
}

void loop(void) {
  u8x8.setFont(u8x8_font_amstrad_cpc_extended_r);
  u8x8.drawString(0,0,"Hello World!");
  delay(1000);
}

You haven’t declared the object.
See the example from the u8x8 github page.

#include <U8x8lib.h>

U8X8_SSD1306_128X64_4W_SW_SPI u8x8(/* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8);

well I'm dumb thanks tho (+1 karma)

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.