Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/follower46/micropython-oled-progressbars
A collection of progress bars for use with esp8266 and esp32's on OLED displays
https://github.com/follower46/micropython-oled-progressbars
esp32 esp8266 i2c-display i2c-lcd micropython
Last synced: about 2 months ago
JSON representation
A collection of progress bars for use with esp8266 and esp32's on OLED displays
- Host: GitHub
- URL: https://github.com/follower46/micropython-oled-progressbars
- Owner: follower46
- License: mit
- Created: 2019-07-29T21:24:34.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-08-01T01:08:35.000Z (over 5 years ago)
- Last Synced: 2024-04-22T12:33:47.857Z (9 months ago)
- Topics: esp32, esp8266, i2c-display, i2c-lcd, micropython
- Language: Python
- Size: 595 KB
- Stars: 12
- Watchers: 2
- Forks: 2
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-micropython - micropython-oled-progressbars - A collection of progress bars for use with ESP8266 and ESP32 on OLED displays. (Libraries / Display)
README
# micropython-oled-progressbars
This is a collection of display elements for showing progress on ssd1306 OLED screen using micropython.The elements are built to reduce draw calls to the frame buffer (improving performance).
If your application requires redraws every update (if, for instance, you have a loading bar which animates across the screen while updating) you can call the "BarBase" class instead which will repaint the entire element on updates.### Video Examples
Painting Methods: https://youtu.be/5uRfoD2mhn8ESP8266 vs ESP32: https://youtu.be/vPRc3ypMsm0
# Usage
## Basic infinite UI bar
![Basic Infinite Bar](/images/basic.jpg)
```python
import ssd1306
import progress_bari2c = I2C(-1, scl=Pin(5), sda=Pin(4))
oled_width = 128
oled_height = 64
oled = ssd1306.SSD1306_I2C(oled_width, oled_height, i2c)# create a new progress bar
infinte_bar = progress_bar.ProgressBar(10, 40, oled.width - 20, 15, oled)oled.text('connecting to', 0, 10)
oled.text('network...', 0, 20)# animate the progress bar
while True:
infinte_bar.update()
oled.show()
```## Infinite UI bar with text
![Infinite Bar With Text](/images/text.jpg)
```python# create a new progress bar
infinte_bar = progress_bar.ProgressBar(10, 40, oled.width - 20, 15, oled)
index = 0
# animate the progress bar
while True:
# set dynamic text on top of bar
infinte_bar.set_text('SLEEPING %s' % index, 0)
infinte_bar.update()
oled.show()
if index >= 99:
index = 0
else:
index += 1
```## Progress UI bar
```python# create a new progress bar
my_bar = progress_bar.ProgressBar(10, 40, oled.width - 20, 15, oled)
index = 0
# animate the progress bar
while True:
# set amount of bar to fill
my_bar.set_percent(index)
my_bar.update()
oled.show()
if index >= 99:
index = 0
else:
index += 1
```