|
| 1 | +/* |
| 2 | + SFE_MicroOLED Library Demo |
| 3 | + Paul Clark @ SparkFun Electronics |
| 4 | + Original Creation Date: December 10th, 2020 |
| 5 | +
|
| 6 | + This sketch uses the MicroOLED library to show all the functionality built into the library |
| 7 | +
|
| 8 | + Hardware Connections: |
| 9 | + This example assumes you are using Qwiic. See the SPI examples for |
| 10 | + a detailed breakdown of connection info. |
| 11 | +
|
| 12 | + This code is beerware; if you see me (or any other SparkFun employee) at the |
| 13 | + local, and you've found our code helpful, please buy us a round! |
| 14 | + |
| 15 | + Distributed as-is; no warranty is given. |
| 16 | +*/ |
| 17 | + |
| 18 | +#include <Wire.h> |
| 19 | +#include <SFE_MicroOLED.h> //Click here to get the library: http://librarymanager/All#SparkFun_Micro_OLED |
| 20 | + |
| 21 | +#define PIN_RESET 9 |
| 22 | +#define DC_JUMPER 0 |
| 23 | +MicroOLED oled(PIN_RESET, DC_JUMPER); // I2C declaration |
| 24 | + |
| 25 | +void setup() |
| 26 | +{ |
| 27 | + delay(100); |
| 28 | + Wire.begin(); |
| 29 | + |
| 30 | + oled.begin(); // Initialize the OLED |
| 31 | + oled.clear(ALL); // Clear the display's internal memory |
| 32 | + oled.display(); // Display what's in the buffer (splashscreen) |
| 33 | +} |
| 34 | + |
| 35 | +void loop() |
| 36 | +{ |
| 37 | + delay(2000); |
| 38 | + oled.scrollRight(0, 7, SCROLL_INTERVAL_2_FRAMES); // Scroll all pages right |
| 39 | + delay(2000); |
| 40 | + oled.scrollVertRight(0, 7, SCROLL_INTERVAL_3_FRAMES); // Scroll all pages vertical right, slower |
| 41 | + delay(2000); |
| 42 | + oled.scrollLeft(0, 7, SCROLL_INTERVAL_4_FRAMES); // Scroll all pages left, slower again |
| 43 | + delay(2000); |
| 44 | + oled.scrollVertLeft(0, 7, SCROLL_INTERVAL_5_FRAMES); // Scroll all pages vertical left, slower still... |
| 45 | +} |
0 commit comments