Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/trevorwslee/micropython-dumbdisplay
DumbDisplay MicroPython Library is a port of the Arduino DumbDisplay Library (https://github.com/trevorwslee/Arduino-DumbDisplay) for the DumbDisplay Android app -- https://play.google.com/store/apps/details?id=nobody.trevorlee.dumbdisplay
https://github.com/trevorwslee/micropython-dumbdisplay
micro-python
Last synced: 1 day ago
JSON representation
DumbDisplay MicroPython Library is a port of the Arduino DumbDisplay Library (https://github.com/trevorwslee/Arduino-DumbDisplay) for the DumbDisplay Android app -- https://play.google.com/store/apps/details?id=nobody.trevorlee.dumbdisplay
- Host: GitHub
- URL: https://github.com/trevorwslee/micropython-dumbdisplay
- Owner: trevorwslee
- Created: 2021-07-31T06:26:53.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2023-10-02T12:43:27.000Z (about 1 year ago)
- Last Synced: 2024-12-25T18:41:30.473Z (1 day ago)
- Topics: micro-python
- Language: Python
- Homepage:
- Size: 144 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# DumbDisplay MicroPython Library (v0.3.1)
DumbDisplay MicroPython Library is a port of the [DumbDisplay Arduino Library](https://github.com/trevorwslee/Arduino-DumbDisplay)
for the [DumbDisplay Android app](https://play.google.com/store/apps/details?id=nobody.trevorlee.dumbdisplay)For a video introduction, please watch the YouTube video: [Introducing DumbDisplay MicroPython Library --
with ESP32, Raspberry Pi Pico, and Raspberry Pi Zero](https://www.youtube.com/watch?v=KVU26FyXs5M)Although the porting is not complete, nevertheless, a large portion of DumbDisplay functionalities have been ported.
Hopefully, this should already be helpful for friends that develop programs for microcontroller boards in Micro-Python.Note that even it is targeted for MicroPython, it is still usable with regular Python 3, like in Raspberry Pi environment,
or even with desktop / laptop.The basic script setup is:
1. import core, for creating `DumbDisplay` object
2. import IO mechanism, for creating IO object
3. import layers, for creating layer objectsFor example
```
from dumbdisplay.core import *
from dumbdisplay.io_inet import *
from dumbdisplay.layer_ledgrid import *
dd = DumbDisplay(io4Inet())
l = LayerLedGrid(dd)
l.turnOn()
```A "very simple" sample that makes use of WiFi can be like
```
from dumbdisplay.core import *
from dumbdisplay.io_wifi import *
from dumbdisplay.layer_ledgrid import *
import time
dd = DumbDisplay(io4Wifi("ssid", "password"))
l = LayerLedGrid(dd, 2, 1)
l.offColor("green")
l.turnOn()
for _ in range(10):
time.sleep(1)
l.toggle(0, 0)
l.toggle(1, 0)
dd.writeComment("DONE")
```A simple sample that polls for feedbacks, can be like
```
from dumbdisplay.core import *
from dumbdisplay.io_inet import *
from dumbdisplay.layer_ledgrid import *
dd = DumbDisplay(io4Inet())
l = LayerLedGrid(dd, 20, 20)
l.enableFeedback("fa")
l.offColor(RGB_COLOR(0xcc, 0xcc, 0xcc))
while True:
feedback = l.getFeedback()
if feedback is not None:
print("l FB: {}: {},{}".format(feedback.type, feedback.x, feedback.y))
l.toggle(feedback.x, feedback.y)
```A more complete simple sample that also shows "auto pin" as well, can be like
```
from dumbdisplay.core import *
from dumbdisplay.io_inet import *
from dumbdisplay.layer_lcd import *
from dumbdisplay.layer_graphical import *_last_x = -1
_color = "red"
def feedback_handler(layer, type, x, y):
global _last_x, _last_y, _color
if layer == l:
if _last_x != -1:
l.drawLine(_last_x, _last_y, x, y, _color)
_last_x = x
_last_y = y
else:
if layer == l_r:
_color = "red"
elif layer == l_g:
_color = "green"
elif layer == l_b:
_color = "blue"
_last_x = -1dd = DumbDisplay(io4Inet())
l_r = LayerLcd(dd)
l_g = LayerLcd(dd)
l_b = LayerLcd(dd)
l = LayerGraphical(dd, 150, 100)
l_r.backgroundColor("red")
l_g.backgroundColor("green")
l_b.backgroundColor("blue")
l.backgroundColor("white")
l.border(3, "black")
l_r.enableFeedback("f", feedback_handler)
l_g.enableFeedback("f", feedback_handler)
l_b.enableFeedback("f", feedback_handler)
l.enableFeedback("fs:rpt50", feedback_handler)
AutoPin('V', AutoPin('H', l_r, l_g, l_b), l).pin(dd)
while True:
dd.sleep(1)
```Notes:
* If seeing ESP32 brownout detection issue, try
```
import machine
machine.reset_cause()
```
* If DumbDisplay Android app fails to make connection to desktop / laptop, check your desktop firewall settings; try switching desktop WIFI to use 2.4 GHz.## Enjoy! Peace be with you! May God bless you! Jesus loves you!
# Change History
v0.3.1
- added LayerJoystickv0.3.0
- checked Raspberry Pi Pico W WIFI support
- ported more options from Arduino DumbDisplay library
- bug fixesv0.2.1
- add plotter layer
- added layer margin
- bug fixes