Skip to content

Instantly share code, notes, and snippets.

@buckle2000
Created May 15, 2017 09:51
Show Gist options
  • Save buckle2000/68dad3f24613d37625e9c2f590dd3f52 to your computer and use it in GitHub Desktop.
Save buckle2000/68dad3f24613d37625e9c2f590dd3f52 to your computer and use it in GitHub Desktop.
#define PIN_RESET 255 //
#define DC_JUMPER 0 // I2C Addres: 0 - 0x3C, 1 - 0x3D
#include <Wire.h> // Include Wire if you're using I2C
#include <SFE_MicroOLED.h> // Include the SFE_MicroOLED library
#include <math.h>
MicroOLED oled(PIN_RESET, DC_JUMPER); // I2C Example
// Global variables to help draw the clock face:
const int MIDDLE_X = oled.getLCDWidth() / 2;
const int MIDDLE_Y = oled.getLCDHeight() / 2;
short now = 0;
void draw() {
if (now > 10) now = -10;
oled.line(MIDDLE_X+now, MIDDLE_Y, MIDDLE_X+now+5, MIDDLE_Y+5);
oled.line(MIDDLE_X-now, MIDDLE_Y, MIDDLE_X-now-5, MIDDLE_Y+5);
}
void setup()
oled.begin(); // Initialize the OLED
}
void loop() {
++now;
oled.clear(PAGE);
draw();
oled.display();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment