https://github.com/tinygo-org/gobadge
TinyGo powered badge using Adafruit Pybadge Hardware
https://github.com/tinygo-org/gobadge
adafruit badge golang hacktoberfest tinygo
Last synced: 3 months ago
JSON representation
TinyGo powered badge using Adafruit Pybadge Hardware
- Host: GitHub
- URL: https://github.com/tinygo-org/gobadge
- Owner: tinygo-org
- Created: 2021-06-15T13:59:29.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2025-05-04T13:51:21.000Z (6 months ago)
- Last Synced: 2025-06-06T03:43:20.815Z (4 months ago)
- Topics: adafruit, badge, golang, hacktoberfest, tinygo
- Language: Go
- Homepage:
- Size: 78.3 MB
- Stars: 38
- Watchers: 6
- Forks: 24
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-tinygo - Gobadge - TinyGo powered badge using Adafruit Pybadge Hardware (Wireless Communication / WASI and WASM Unknown)
README
# GoBadge
TinyGo powered badge using the Adafruit Pybadge hardware aka "GoBadge".
https://www.adafruit.com/product/4200
# How to install
- Install TinyGo using the instructions from https://tinygo.org
- Clone this repo
- Change directories into the directory with the repo
- Connect your Gobadge to your computer using a USB cable
- Make sure to turn on the badge, flip the switch at the top of the board next to `select` to the `on` position. The screen should light up and might be showing a sine wave display (if it was not already flashed to something else).
***Important Note***
The first time you flash your new GoBadge, you will probably need to double-click the "Reset" button located on the back of the badge in order to put the badge into bootloader mode. This will only need to be done once on brand new badges, after that you can flash it normally.
- Run this command to compile and flash the code to your Gobadge:
If you are running Mac or Linux, or have make installed you can run the following:
```
make flash
```otherwise run tinygo directly
```
tinygo flash -target gobadge .
```Note: if you get a `permision denied` error; please, consult this [page](https://tinygo.org/docs/guides/tinygo-flash-errors/) for possible solution. You many need to restart the computer; afterward to get the group to stick.
- To display a conference logo on your badge, use one of the following targets (depending on GC for Europe, UK, or US):
```
make flash-gceu
make flash-gcuk
make flash-gcus
```- To customize the Gobadge with your own name and information, use the `NAME`, `TITLE1`, and `TITLE2` variables like this:
```
make flash-gcus NAME="@TinyGolang" TITLE1="Go compiler" TITLE2="small places"
```# Add a new logo
- Create an image with a 160x128 pixels size, copy it into `cmd/assets` folder.
For the moment only jpeg images are supported.
- In `cmd/main.go` add the path to your file here```go
const (
gopherconEU22Logo = "./cmd/assets/gopherconeu-2022.jpg"
gopherconUK22Logo = "./cmd/assets/gopherconuk-2022.jpg"
gopherconUS22Logo = "./cmd/assets/gopherconus-2022.jpg"
yourPathLogoHere = "./your/path/to/the/logo"
)
```- Add the corresponding flag to the conf map:
```go
func confs() map[string]string {
return map[string]string{
"gceu22" : gopherconEU22Logo,
"gcuk22" : gopherconUK22Logo,
"gcus22" : gopherconUS22Logo,
"flagLogo" : yourPathLogoHere,
}
}
```Add a new target to the Makefile:
```bash
flash-yourconf:
go run cmd/main.go -conf=flagLogo
tinygo flash -target gobadge .
```You can run:
```bash
make flash-yourconf
```It will use `cmd/logos/logo-template.txt` to generate the image into a `[]color.RGBA`.
Then it is stored in variable in `logo.go` file.```go
package mainimport "image/color"
var logoRGBA = []color.RGBA{ {255, 255, 255} }
```After the image has been generated, the make command will flash it to the board.
👏 Congratulations! It is now a GoBadge.