pimoroni-pico/micropython/examples/badger2040/README.md

93 wiersze
2.7 KiB
Markdown
Czysty Zwykły widok Historia

2022-02-24 18:50:42 +00:00
# Badger 2040 Examples <!-- omit in toc -->
- [Function Examples](#function-examples)
- [Battery](#battery)
- [Button Test](#button-test)
- [LED](#led)
- [Pin interrupt](#pin-interrupt)
2022-02-24 18:50:42 +00:00
- [Application Examples](#application-examples)
- [Badge](#badge)
- [Checklist](#checklist)
- [Clock](#clock)
- [E-Book](#e-book)
2022-02-24 18:50:42 +00:00
- [Fonts](#fonts)
- [Image](#image)
- [QR gen](#qr-gen)
2022-02-24 18:50:42 +00:00
- [Launcher](#launcher)
## Function Examples
### Battery
[battery.py](battery.py)
An example of how to read the battery voltage and display a battery level indicator.
### Button Test
[button_test.py](button_test.py)
An example of how to read Badger2040's buttons and display a unique message for each.
2022-02-28 16:19:48 +00:00
### LED
[led.py](led.py)
2022-03-04 09:00:04 +00:00
Blinks Badger's LED on and off.
2022-02-28 16:19:48 +00:00
### Pin interrupt
[pin_interrupt.py](pin_interrupt.py)
An example of drawing text and graphics and using the buttons.
2022-02-24 18:50:42 +00:00
## Application Examples
### Badge
[badge.py](badge.py)
Create your own name badge! This application looks for two files on your MicroPython drive:
* `badge.txt` - A text file containing 6 lines, corresponding to the 6 different pieces of text on the badge
* `badge-image.bin` - A 108x128px 1-bit colour depth image to display alongside the text. You can use `examples/badger2040/image_converter/convert.py` to convert them:
2022-02-24 18:50:42 +00:00
```shell
2022-02-24 18:50:42 +00:00
python3 convert.py --binary --resize image_file_1.png image_file_2.png image_file_3.png
```
2022-02-24 18:50:42 +00:00
### Checklist
[list.py](list.py)
2022-02-24 18:50:42 +00:00
A checklist application, letting you navigate through items and tick each of them off.
### Clock
[clock.py](clock.py)
2022-02-28 16:19:48 +00:00
A simple clock showing the time and date, that uses the E Ink's fast speed to update every second
2022-02-24 18:50:42 +00:00
### E-Book
[ebook.py](ebook.py)
2022-02-24 18:50:42 +00:00
A mini text file e-reader. Comes pre-loaded with an excerpt of The Wind In the Willows.
### Fonts
[fonts.py](fonts.py)
2022-02-24 18:50:42 +00:00
A demonstration of the various fonts that can be used in your programs.
### Image
[image.py](image.py)
An image gallery. Displays and lets you cycle through any images stored within the MicroPython device's `/images` directory. Images must be 296x128 pixels with 1-bit colour depth. You can use `examples/badger2040/image_converter/convert.py` to convert them:
2022-02-24 18:50:42 +00:00
```shell
2022-02-24 18:50:42 +00:00
python3 convert.py --binary --resize image_file_1.png image_file_2.png image_file_3.png
```
### QR gen
[qrgen.py](qrgen.py)
This application looks for a file on your MicroPython drive:
- `qrcode.txt` - A text file containing 9 lines. The first line should be a URL which will be converted into and displayed as a QR code. Up to 8 more lines of information can be added, which will be shown as plain text to the right of the QR code.
2022-02-24 18:50:42 +00:00
### Launcher
[launcher.py](launcher.py)
2022-02-24 18:50:42 +00:00
A launcher-style application, that provide a menu of other applications that can be loaded, as well as information such as battery level.