Skip to content

Commit aba8ee9

Browse files
author
Kirk
committed
mega merge of nates stuff, my bitmap updates
2 parents c39cab5 + d55e3c3 commit aba8ee9

File tree

19 files changed

+1375
-1270
lines changed

19 files changed

+1375
-1270
lines changed

examples/Example-01_Hello/Example-01_Hello.ino

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
Example-01_Hello.ino
3-
3+
44
This is a library written for SparkFun Qwiic OLED boards that use the SSD1306.
55
66
SparkFun sells these at its website: www.sparkfun.com
@@ -10,13 +10,13 @@
1010
Micro OLED https://www.sparkfun.com/products/14532
1111
Transparent OLED https://www.sparkfun.com/products/15173
1212
"Narrow" OLED https://www.sparkfun.com/products/17153
13-
14-
13+
14+
1515
Written by Kirk Benell @ SparkFun Electronics, March 2022
1616
17-
This library configures and draws graphics to OLED boards that use the
17+
This library configures and draws graphics to OLED boards that use the
1818
SSD1306 display hardware. The library only supports I2C.
19-
19+
2020
Repository:
2121
https://github.com/sparkfun/SparkFun_Qwiic_OLED_Arduino_Library
2222
@@ -33,7 +33,7 @@
3333
>> Overview <<
3434
3535
This demo shows the basic setup of the OLED library, generating simple graphics and displaying
36-
the results on the target device.
36+
the results on the target device.
3737
*/
3838
////////////////////////////////////////////////////////////////////////////////////////
3939
// >>> SELECT THE CONNECTED DEVICE FOR THIS EXAMPLE <<<
@@ -61,25 +61,24 @@
6161

6262
#if defined(TRANSPARENT)
6363
QwiicTransparentOLED myOLED;
64-
const char * deviceName = "Transparent OLED";
64+
const char *deviceName = "Transparent OLED";
6565

6666
#elif defined(NARROW)
6767
QwiicNarrowOLED myOLED;
68-
const char * deviceName = "Narrow OLED";
68+
const char *deviceName = "Narrow OLED";
6969

7070
#else
7171
QwiicMicroOLED myOLED;
72-
const char * deviceName = "Micro OLED";
72+
const char *deviceName = "Micro OLED";
7373

7474
#endif
7575

76-
7776
////////////////////////////////////////////////////////////////////////////////////////////////
7877
// setup()
7978

8079
void setup()
8180
{
82-
delay(500); //Give display time to power on
81+
delay(500); // Give display time to power on
8382

8483
// Serial on!
8584
Serial.begin(115200);
@@ -90,42 +89,44 @@ void setup()
9089
Serial.println(String(deviceName));
9190

9291
// Initalize the OLED device and related graphics system
93-
if(!myOLED.begin()){
92+
if (!myOLED.begin())
93+
{
9494

9595
Serial.println(" - Device Begin Failed");
96-
while(1);
96+
while (1)
97+
;
9798
}
9899

99100
Serial.println("- Begin Success");
100101

101102
// Do a simple test - fill a rectangle on the screen and then print hello!
102103

103104
// fill a rectangle on the screen that has a 4 pixel board
104-
myOLED.rectangleFill(4, 4, myOLED.getWidth()-8, myOLED.getHeight()-8);
105+
myOLED.rectangleFill(4, 4, myOLED.getWidth() - 8, myOLED.getHeight() - 8);
105106

106107
String hello = "hello"; // our message
107108

108109
// Center our message on the screen. Use our Font Descriptor: QW_FONT_5X7, the default
109110
// font of the system.
110111

111112
// starting x position - width minus string length (font width * number of characters) / 2
112-
int x0 = (myOLED.getWidth() - QW_FONT_5X7.width * hello.length())/2;
113+
int x0 = (myOLED.getWidth() - QW_FONT_5X7.width * hello.length()) / 2;
113114

114-
int y0 = (myOLED.getHeight() - QW_FONT_5X7.height)/2;
115+
int y0 = (myOLED.getHeight() - QW_FONT_5X7.height) / 2;
115116

116117
// Draw the text - color of black (0)
117118
myOLED.text(x0, y0, hello, 0);
118119

119120
// There's nothing on the screen yet - Now send the graphics to the device
120121
myOLED.display();
121122

122-
// That's it - HELLO!
123-
123+
// That's it - HELLO!
124124
}
125125

126-
// Standard Arduino loop function.
127-
void loop(){
126+
// Standard Arduino loop function.
127+
void loop()
128+
{
128129

129-
// All loop does in sleep.
130+
// All loop does in sleep.
130131
delay(1000);
131132
}

0 commit comments

Comments
 (0)