Created
November 27, 2016 02:08
-
-
Save haru01/d7926e7198724df94945580bbf4f6848 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 <Arduino.h> | |
#include <U8g2lib.h> | |
#ifdef U8X8_HAVE_HW_SPI | |
#include <SPI.h> | |
#endif | |
#ifdef U8X8_HAVE_HW_I2C | |
#include <Wire.h> | |
#endif | |
U8G2_SSD1306_128X64_NONAME_F_SW_I2C u8g2(U8G2_R0, /* clock=*/ SCL, /* data=*/ SDA, /* reset=*/ U8X8_PIN_NONE); // All Boards without Reset of the Display | |
void setup(void) { | |
u8g2.begin(); | |
} | |
int count = 0; | |
void loop(void) { | |
count++; | |
char buf[12]; | |
u8g2.clearBuffer(); // clear the internal memory | |
u8g2.setFont(u8g2_font_ncenB14_tr); // choose a suitable font | |
u8g2.drawStr(0,40, itoa(count, buf, 10)); // write something to the internal memory | |
u8g2.sendBuffer(); // transfer internal memory to the display | |
delay(1000); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment