Skip to content

follower46/micropython-oled-progressbars

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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/5uRfoD2mhn8

ESP8266 vs ESP32: https://youtu.be/vPRc3ypMsm0

Usage

Basic infinite UI bar

Basic Infinite Bar

import ssd1306
import progress_bar

i2c = 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

# 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

# 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

About

A collection of progress bars for use with esp8266 and esp32's on OLED displays

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy