Created
May 15, 2017 09:51
-
-
Save buckle2000/68dad3f24613d37625e9c2f590dd3f52 to your computer and use it in GitHub Desktop.
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
#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