Skip to content

Commit 622901a

Browse files
committed
Updating display MIDI messages example
Updating the code for the MIDI display messages example in the MIDI for Makers guide updating display height, x coord for text and added a comment for new board.STEMMA_I2C() option in CP 7.2
1 parent a981aeb commit 622901a

File tree

1 file changed

+8
-2
lines changed
  • MIDI_for_Makers/Receive_and_Display_MIDI_Messages

1 file changed

+8
-2
lines changed

MIDI_for_Makers/Receive_and_Display_MIDI_Messages/code.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,13 @@
1919
oled_reset = board.D1
2020

2121
# I2C setup for display
22+
23+
# STEMMA I2C setup pre-CP 7.2
2224
i2c = busio.I2C(board.SCL1, board.SDA1)
25+
26+
# STEMMA I2C setup for CP 7.2+
27+
# i2c = board.STEMMA_I2C()
28+
2329
display_bus = displayio.I2CDisplay(i2c, device_address=0x3D, reset=oled_reset)
2430

2531
# midi setup
@@ -32,7 +38,7 @@
3238

3339
# display width and height setup
3440
WIDTH = 128
35-
HEIGHT = 32
41+
HEIGHT = 64
3642
BORDER = 5
3743

3844
# display setup
@@ -44,7 +50,7 @@
4450
# text area setup
4551
text = "MIDI Messages"
4652
text_area = label.Label(
47-
terminalio.FONT, text=text, color=0xFFFFFF, x=28, y=HEIGHT // 2+1)
53+
terminalio.FONT, text=text, color=0xFFFFFF, x=30, y=HEIGHT // 2+1)
4854
splash.append(text_area)
4955

5056
while True:

0 commit comments

Comments
 (0)