-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from ladyada/master
Add support for the charlie bonnet
- Loading branch information
Showing
7 changed files
with
145 additions
and
107 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,46 @@ | ||
import board | ||
import busio | ||
import framebuf | ||
import adafruit_framebuf | ||
import adafruit_is31fl3731 | ||
|
||
buf = bytearray(32) | ||
|
||
with busio.I2C(board.SCL, board.SDA) as i2c: | ||
# initial display using Feather CharlieWing LED 15 x 7 | ||
display = adafruit_is31fl3731.CharlieWing(i2c) | ||
# uncomment line if you are using Adafruit 16x9 Charlieplexed PWM LED Matrix | ||
#display = adafruit_is31fl3731.Matrix(i2c) | ||
|
||
fb = framebuf.FrameBuffer(buf, display.width, display.height, framebuf.MONO_VLSB) | ||
text_to_show = "Adafruit!!" | ||
frame = 0 # start with frame 0 | ||
while True: | ||
for i in range(len(text_to_show) * 9): | ||
fb.fill(0) | ||
fb.text(text_to_show, -i + display.width, 0) | ||
|
||
# to improve the display flicker we can use two frame | ||
# fill the next frame with scrolling text, then | ||
# show it. | ||
display.frame(frame, show=False) | ||
# turn all LEDs off | ||
display.fill(0) | ||
for x in range(display.width): | ||
# using the FrameBuffer text result | ||
bite = buf[x] | ||
for y in range(display.height): | ||
bit = 1 << y & bite | ||
# if bit > 0 then set the pixel brightness | ||
if bit: | ||
display.pixel(x, y, 50) | ||
|
||
# now that the frame is filled, show it. | ||
display.frame(frame, show=True) | ||
frame = 0 if frame else 1 | ||
|
||
i2c = busio.I2C(board.SCL, board.SDA) | ||
|
||
# initial display using Feather CharlieWing LED 15 x 7 | ||
#display = adafruit_is31fl3731.CharlieWing(i2c) | ||
# uncomment line if you are using Adafruit 16x9 Charlieplexed PWM LED Matrix | ||
#display = adafruit_is31fl3731.Matrix(i2c) | ||
# uncomment line if you are using Adafruit 16x9 Charlieplexed PWM LED Matrix | ||
display = adafruit_is31fl3731.CharlieBonnet(i2c) | ||
|
||
text_to_show = "Adafruit!!" | ||
|
||
# Create a framebuffer for our display | ||
buf = bytearray(32) # 2 bytes tall x 16 wide = 32 bytes (9 bits is 2 bytes) | ||
fb = adafruit_framebuf.FrameBuffer(buf, display.width, display.height, adafruit_framebuf.MVLSB) | ||
|
||
|
||
frame = 0 # start with frame 0 | ||
while True: | ||
for i in range(len(text_to_show) * 9): | ||
fb.fill(0) | ||
fb.text(text_to_show, -i + display.width, 0, color=1) | ||
|
||
# to improve the display flicker we can use two frame | ||
# fill the next frame with scrolling text, then | ||
# show it. | ||
display.frame(frame, show=False) | ||
# turn all LEDs off | ||
display.fill(0) | ||
for x in range(display.width): | ||
# using the FrameBuffer text result | ||
bite = buf[x] | ||
for y in range(display.height): | ||
bit = 1 << y & bite | ||
# if bit > 0 then set the pixel brightness | ||
if bit: | ||
display.pixel(x, y, 50) | ||
|
||
# now that the frame is filled, show it. | ||
display.frame(frame, show=True) | ||
frame = 0 if frame else 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
Adafruit-Blinka | ||
Adafruit-Blinka | ||
adafruit-circuitpython-framebuf |