Skip to content

Commit 6267ee3

Browse files
Tested examples on all three OLED types on MicroPython
1 parent c0f6f7a commit 6267ee3

File tree

8 files changed

+21
-24
lines changed

8 files changed

+21
-24
lines changed

examples/ex1_splash_screen.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#-----------------------------------------------------------------------------
33
# ex1_splash_screen.py
44
#
5-
# Simple Example for an OLED Display
5+
# Simple Example for an OLED Display that displays the SparkFun splash screen
66
#------------------------------------------------------------------------
77
#
88
# Written by SparkFun Electronics, May 2021
@@ -36,8 +36,6 @@
3636
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
3737
# SOFTWARE.
3838
#==================================================================================
39-
# Example 1 - Simple example to display the splash screen bitmap
40-
#
4139

4240
import qwiic_oled
4341
import time

examples/ex2_hello_world.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@
3636
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
3737
# SOFTWARE.
3838
#==================================================================================
39-
# Example 2 - Simple example to display "hello world"
40-
#
4139

4240
import qwiic_oled
4341
import sys

examples/ex3_demo.py

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#-----------------------------------------------------------------------------
33
# ex3_demo.py
44
#
5-
# Demo Example for an OLED Display
5+
# An example showing various features of the display driver for Qwiic OLED displays
66
#------------------------------------------------------------------------
77
#
88
# Written by SparkFun Electronics, May 2021
@@ -36,8 +36,6 @@
3636
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
3737
# SOFTWARE.
3838
#==================================================================================
39-
# Example 3 - An example showing various features of the display driver
40-
#
4139

4240
import qwiic_oled
4341
import time
@@ -189,6 +187,14 @@ def shapeExample(myOLED):
189187

190188
time.sleep(.2)
191189

190+
def show_done(myOLED):
191+
myOLED.set_font_type(1)
192+
myOLED.clear(myOLED.PAGE)
193+
myOLED.set_cursor(0, 0)
194+
myOLED.print("DONE!")
195+
myOLED.display()
196+
time.sleep(1)
197+
192198
#-------------------------------------------------------------------
193199
def textExamples(myOLED):
194200

@@ -271,6 +277,7 @@ def textExamples(myOLED):
271277
myOLED.print("A1: ")
272278
myOLED.set_font_type(2)
273279

280+
# Note: For the "narrow" display, we can only fit the above two lines, so A2 will not be seen.
274281
myOLED.print("%.3d" % randint(0,255))
275282
myOLED.set_cursor(0, 32)
276283
myOLED.set_font_type(0)
@@ -282,6 +289,11 @@ def textExamples(myOLED):
282289
time.sleep(.1)
283290

284291
# Demonstrate font 3. 12x48. Stopwatch demo.
292+
if myOLED.get_lcd_height() < 48:
293+
# The "narrow" display doesn't have enough height to fully display font 3 or 4 so we'll end the demo here.
294+
show_done(myOLED)
295+
return
296+
285297
myOLED.set_font_type(3) # Use the biggest font
286298
ms = 0
287299
s = 0
@@ -321,13 +333,7 @@ def textExamples(myOLED):
321333
myOLED.display()
322334
time.sleep(1)
323335

324-
myOLED.set_font_type(1)
325-
myOLED.clear(myOLED.PAGE)
326-
myOLED.set_cursor(0, 0)
327-
myOLED.print("DONE!")
328-
myOLED.display()
329-
time.sleep(1)
330-
336+
show_done(myOLED)
331337

332338
#-------------------------------------------------------------------
333339

examples/ex4_cube.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,6 @@
3535
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
3636
# SOFTWARE.
3737
#==================================================================================
38-
# Example - simple command to draw a cube the OLED.
39-
#
40-
4138

4239
import qwiic_oled
4340
import sys

examples/ex5_micro_bitmap.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#-----------------------------------------------------------------------------
33
# ex5_micro_bitmap.py
44
#
5-
# Simple Example for the Qwiic Micro OLED display
5+
# Example for the Qwiic Micro OLED display that displays Bender's face!
66
#------------------------------------------------------------------------
77
#
88
# Written by SparkFun Electronics, May 2021
@@ -36,8 +36,6 @@
3636
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
3737
# SOFTWARE.
3838
#==================================================================================
39-
# Example 1 - Simple example to display a bitmap on the Qwiic Micro OLED board.
40-
#
4139

4240
import qwiic_oled
4341
import time

qwiic_oled/qwiic_large_oled.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
import math
5656
import qwiic_i2c
5757

58-
from qwiic_oled_base import QwiicOledBase
58+
from qwiic_oled import QwiicOledBase
5959

6060
# Define the device name and I2C addresses. These are set in the class defintion
6161
# as class variables, making them avilable without having to create a class instance.

qwiic_oled/qwiic_micro_oled.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
import math
5656
import qwiic_i2c
5757

58-
from qwiic_oled_base import QwiicOledBase
58+
from qwiic_oled import QwiicOledBase
5959

6060
# Define the device name and I2C addresses. These are set in the class defintion
6161
# as class variables, making them avilable without having to create a class instance.

qwiic_oled/qwiic_oled_display.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
import math
5656
import qwiic_i2c
5757

58-
from qwiic_oled_base import QwiicOledBase
58+
from qwiic_oled import QwiicOledBase
5959

6060
# Define the device name and I2C addresses. These are set in the class defintion
6161
# as class variables, making them avilable without having to create a class instance.

0 commit comments

Comments
 (0)