.. leading zeros are required for `frontmatter` to treat them as dates
rather than strings, apparently per the YAML specification.
This was done by script:
```py
import re
import datetime
import pathlib
import sys
import frontmatter
rx = re.compile(r'^(\s*)date_added:.*$', re.M)
for path_str in sys.argv[1:]:
print(path_str)
path = pathlib.Path(path_str)
post = frontmatter.load(path)
date_added = post.get("date_added", "")
if isinstance(date_added, datetime.date):
continue
if isinstance(date_added, str):
try:
date_added = datetime.datetime.strptime(date_added, "%Y-%m-%d")
except ValueError as exc:
print(f"Failed to parse date {date_added} in {path_str}: {exc}")
continue
date_added = date_added.date()
content = path.read_text("utf-8")
new_content = rx.sub(lambda m: f"{m.group(1)}date_added: {date_added}", content)
assert content != new_content
path.write_text(new_content, "utf-8")
```
47 lines
2.7 KiB
Markdown
47 lines
2.7 KiB
Markdown
---
|
||
layout: download
|
||
board_id: "pybadge"
|
||
title: "PyBadge Download"
|
||
name: "PyBadge"
|
||
manufacturer: "Adafruit"
|
||
board_url:
|
||
- "https://www.adafruit.com/product/4200"
|
||
- "https://www.adafruit.com/product/3939"
|
||
- "https://www.adafruit.com/product/4623"
|
||
- "https://www.adafruit.com/product/4624"
|
||
- "https://www.adafruit.com/product/4317"
|
||
board_image: "pybadge.jpg"
|
||
date_added: 2019-03-19
|
||
family: atmel-samd
|
||
bootloader_id: arcade_pybadge
|
||
features:
|
||
- Display
|
||
- Speaker
|
||
- Feather-Compatible
|
||
- Battery Charging
|
||
---
|
||
|
||
The Adafruit PyBadge an all-in-one compact dev board programmable in CircuitPython. Full of features squeezed onto a 3 3⁄8 × 2 1⁄8 inch rounded credit card sized rectangle. It's a perfect wearable badge, but can be used for many projects.
|
||
|
||
The PyBadge is powered by our favorite microcontroller, the ATSAMD51, with 512KB of flash and 192KB of RAM. There is an additional 2 MB of QSPI flash for file storage, handy for images, fonts, sounds, or game assets.
|
||
|
||
On the front, there is a 1.8" 160x128 color TFT display with dimmable backlight. There is fast DMA support for drawing, so updates are incredibly fast. There are also 8 silicone-top buttons: they are clicky but have a soft button top so they're nice and grippy. The buttons are arranged to mimic a gaming handheld, with a d-pad, 2 menu-select buttons and 2 fire-action buttons. There are also 5 NeoPixel LEDs to dazzle or track activity.
|
||
|
||
On the back, there is a full Feather-compatible header socket set, so you can plug in any FeatherWing to expand the capabilities of the PyBadge. There are also 3 STEMMA connectors - two 3-pin with ADC/PWM capability and one 4-pin that connects to I2C - you can use this for Grove sensors as well.
|
||
|
||
For built-in sensors, there is a light sensor that points out the front, and a 3-axis accelerometer that can detect taps and free-fall. To make bleeps and bloops, there's a built in buzzer-speaker. For projects where you need more volume, you can plug in an 8 ohm speaker.
|
||
|
||
You can power the PyBadge from any of Adafruit's LiPoly batteries, but [this 400mAh one](https://www.adafruit.com/category/574) is suggested. An on-off switch will save battery power when not in use. Or power the board from the Micro USB port - it will also charge the battery if one is attached.
|
||
|
||
[](https://youtu.be/n2rzrYRAPYI?t=762 "PyBadge")
|
||
|
||
There is a variant on the Adafruit PyBadge, the Adafruit PyBadge LC, which has a subset of the PyBadge features.
|
||
|
||
## Tutorial
|
||
|
||
- [PyBadge Overview](https://learn.adafruit.com/adafruit-pybadge)
|
||
- [Projects and Guides](https://learn.adafruit.com/products/4200/guides)
|
||
|
||
## Purchase
|
||
|
||
* [Adafruit](https://www.adafruit.com/product/4200)
|