Firmware library SparkFun's Photon Micro OLED Shield.
This is a firmware library for SparkFun's Photon Micro OLED Shield.
With a bit of extra setup, it'll also work with the Micro OELD Breakout.
You can use this library to draw pixels, lines, circles, squares, and text on the micro OLED's 64x48 display.
- /firmware - Source files for the library (.cpp, .h).
- /firmware/examples - Example sketches for the library (.cpp). Run these from the Particle IDE.
- spark.json - General library properties for the Particel library manager.
Include the library, declare a MicroOLED object, and set the display up with these snippets of code:
#include "SparkFunMicroOLED.h" // Include the SFE_MicroOLED library
...
//////////////////////////
// MicroOLED Definition //
//////////////////////////
#define PIN_RESET D7 // Connect RST to pin 7 (req. for SPI and I2C)
#define PIN_DC D3 // Connect DC to pin 3 (required for SPI)
#define PIN_CS A2 // Connect CS to pin A2 (required for SPI)
//////////////////////////////////
// MicroOLED Object Declaration //
//////////////////////////////////
// Declare a MicroOLED object. The parameters include:
// 1 - Mode: Should be either MODE_SPI or MODE_I2C
// 2 - Reset pin: Any digital pin
// 3 - D/C pin: Any digital pin (SPI mode only)
// 4 - CS pin: Any digital pin (SPI mode only, 10 recommended)
MicroOLED oled(MODE_SPI, PIN_RESET, PIN_DC, PIN_CS);
...
void setup()
{
oled.begin(); // Initialize the OLED
oled.clear(ALL); // Clear the OLED's internal display buffer
oled.display(); // Display whatever is in the firmware display buffer (SparkFun logo by default)
}
Check out the example files in the examples directory for more guidance.
- LCD Assistant - Useful tool for generating images
This product is open source!
Please review the LICENSE.md file for license information.
If you have any questions or concerns on licensing, please contact [email protected].
Distributed as-is; no warranty is given.
- Your friends at SparkFun.