|
27 | 27 | * https://thingpulse.com |
28 | 28 | * |
29 | 29 | */ |
30 | | - |
| 30 | + |
31 | 31 | // Include the correct display library |
32 | | -// For a connection via I2C using Wire include |
33 | | -#include <Wire.h> // Only needed for Arduino 1.6.5 and earlier |
34 | | -#include "SSD1306Wire.h" // legacy include: `#include "SSD1306.h"` |
35 | | -// or #include "SH1106Wire.h", legacy include: `#include "SH1106.h"` |
36 | | -// For a connection via I2C using brzo_i2c (must be installed) include |
37 | | -// #include <brzo_i2c.h> // Only needed for Arduino 1.6.5 and earlier |
| 32 | + |
| 33 | +// For a connection via I2C using the Arduino Wire include: |
| 34 | +#include <Wire.h> // Only needed for Arduino 1.6.5 and earlier |
| 35 | +#include "SSD1306Wire.h" // legacy: #include "SSD1306.h" |
| 36 | +// OR #include "SH1106Wire.h" // legacy: #include "SH1106.h" |
| 37 | + |
| 38 | +// For a connection via I2C using brzo_i2c (must be installed) include: |
| 39 | +// #include <brzo_i2c.h> // Only needed for Arduino 1.6.5 and earlier |
38 | 40 | // #include "SSD1306Brzo.h" |
39 | | -// #include "SH1106Brzo.h" |
40 | | -// For a connection via SPI include |
41 | | -// #include <SPI.h> // Only needed for Arduino 1.6.5 and earlier |
| 41 | +// OR #include "SH1106Brzo.h" |
| 42 | + |
| 43 | +// For a connection via SPI include: |
| 44 | +// #include <SPI.h> // Only needed for Arduino 1.6.5 and earlier |
42 | 45 | // #include "SSD1306Spi.h" |
43 | | -// #include "SH1106SPi.h" |
| 46 | +// OR #include "SH1106SPi.h" |
| 47 | + |
44 | 48 |
|
45 | | -// Include custom images |
| 49 | +// Optionally include custom images |
46 | 50 | #include "images.h" |
47 | 51 |
|
48 | | -// Initialize the OLED display using SPI |
| 52 | + |
| 53 | +// Initialize the OLED display using Arduino Wire: |
| 54 | +SSD1306Wire display(0x3c, SDA, SCL); // ADDRESS, SDA, SCL - SDA and SCL usually populate automatically based on your board's pins_arduino.h |
| 55 | +// SSD1306Wire display(0x3c, D3, D5); // ADDRESS, SDA, SCL - If not, they can be specified manually. |
| 56 | +// SSD1306Wire display(0x3c, SDA, SCL, GEOMETRY_128_32); // ADDRESS, SDA, SCL, OLEDDISPLAY_GEOMETRY - Extra param required for 128x32 displays. |
| 57 | +// SH1106 display(0x3c, SDA, SCL); // ADDRESS, SDA, SCL |
| 58 | + |
| 59 | +// Initialize the OLED display using brzo_i2c: |
| 60 | +// SSD1306Brzo display(0x3c, D3, D5); // ADDRESS, SDA, SCL |
| 61 | +// or |
| 62 | +// SH1106Brzo display(0x3c, D3, D5); // ADDRESS, SDA, SCL |
| 63 | + |
| 64 | +// Initialize the OLED display using SPI: |
49 | 65 | // D5 -> CLK |
50 | 66 | // D7 -> MOSI (DOUT) |
51 | 67 | // D0 -> RES |
52 | 68 | // D2 -> DC |
53 | 69 | // D8 -> CS |
54 | | -// SSD1306Spi display(D0, D2, D8); |
| 70 | +// SSD1306Spi display(D0, D2, D8); // RES, DC, CS |
55 | 71 | // or |
56 | | -// SH1106Spi display(D0, D2); |
57 | | - |
58 | | -// Initialize the OLED display using brzo_i2c |
59 | | -// D3 -> SDA |
60 | | -// D5 -> SCL |
61 | | -// SSD1306Brzo display(0x3c, D3, D5); |
62 | | -// or |
63 | | -// SH1106Brzo display(0x3c, D3, D5); |
64 | | - |
65 | | -// Initialize the OLED display using Wire library |
66 | | -SSD1306Wire display(0x3c, D3, D5); |
67 | | -// SH1106 display(0x3c, D3, D5); |
| 72 | +// SH1106Spi display(D0, D2); // RES, DC |
68 | 73 |
|
69 | 74 |
|
70 | 75 | #define DEMO_DURATION 3000 |
|
0 commit comments