![]() The last step to the OLED setup should occur in the setup() function. You can even create more than one, if you have more displays connected to your Arduino. In the example above we've called our MicroOLED object oled, but you can call it anything you'd like. If you're using SPI to talk to the display, define three parameters to tell the library which pins you have RST, D/C and CS connected to, respectively. MicroOLED oled(PIN_RESET, DC_JUMPER) //Example I2C declaration, uncomment if using I2C MicroOLED oled(PIN_RESET, PIN_DC, PIN_CS) //Example SPI declaration, comment out if using I2C 3 - CS pin: Any digital pin (SPI mode only, 10 recommended) 2 - D/C pin: Any digital pin (SPI mode only) Also connect pin 13 to SCK and pin 11 to MOSI #define DC_JUMPER 0 // Set to either 0 (default) or 1 based on jumper, matching the value of the DC Jumper #define PIN_CS 10 // Connect CS to pin 10 (required for SPI) #define PIN_DC 8 // Connect DC to pin 8 (required for SPI) #define PIN_RESET 9 // Connect RST to pin 9 (req. This is where you'll tell the library whether you're using SPI or I 2C, and which pins are driving the display. language:cĪfter you've included the library, you can create a MicroOLED object in the global variable area of your code. On top of that, you'll also need to include the SPI and Wire libraries so the SFE_MicroOLED library has access to those interfaces. Including, Initializing, and BeginningĪt the top of your code, of course, you'll need to include the SFE_MicroOLED library. Now that you've loaded up the example, and proven out your display and hookup, it's time to get started writing your own application! Before you get started, here's a quick rundown of the SFE_MicroOLED library. Share on Twitter Share on Facebook Pin It Using the Arduino Library
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |