Created
November 26, 2019 08:19
-
-
Save RobolinkAkademi/c1338540a10608b45c9ce05235d081b9 to your computer and use it in GitHub Desktop.
arduino I2C oled Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "U8glib.h" | |
U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NONE | U8G_I2C_OPT_DEV_0); | |
char bufferX [20]; | |
char bufferY [20]; | |
char bufferZ [20]; | |
void setup() { | |
} | |
void loop() { | |
sprintf(bufferX, "Robolink Akademi"); | |
sprintf(bufferY, " OLED"); | |
sprintf(bufferZ, " Example"); | |
u8g.firstPage(); | |
do { | |
draw(); | |
} while ( u8g.nextPage() ); | |
delay(10); | |
} | |
void draw(void) | |
{ | |
u8g.setFont(u8g_font_unifont); | |
u8g.drawStr( 0, 20, bufferX); | |
u8g.drawStr( 0, 40, bufferY); | |
u8g.drawStr( 0, 60, bufferZ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment