DEV Community

Playing with my PyBadge

🗃 This is another old post from Coding Grace but a fun one that I want to share with the dev.to community. Enjoy! -- Vicky 😊

🥰 Finally got my hands on a PyBadge (thanks, @micktwomey), been waiting impatiently ever since it was first announced, I think I saw it either via Adafruit's newsletter or their Youtube video (I recommend you subscribe to both).

It was a couple of weeks since my first play around with the PyBadge and I wanted to try out PyBadger. So I followed the instructions, it was all grand until I wanted to get the neopixels to light up like the last time I played with it.

So I looked at the official PyBadge code example again: https://github.com/adafruit/Adafruit_Learning_System_Guides/tree/master/PyBadge_Conference_Badge

Hacked the code a bit and ran it, it says that D8 is already in use (the neopixels). 😓🤔

Looked up neopixels docs on https://learn.adafruit.com/adafruit-neopixel-uberguide/python-circuitpython
Okay... code seems to be ok, why doesn't it work...🤔

I double-checked D8 according to the pinouts on Adadruit website, that's the neopixels I want to use alright.

Hmmm, ok, so I went to check out the PyBadger docs on https://circuitpython.readthedocs.io/projects/pybadger/en/latest/api.html
🔎 I noticed that there's a mention of "pixels" - Sequence like object representing the NeoPixels on the board. Double-hmm... this might be it. 🙌

The code in the pybadge source code on github created pixels as a list variable, whereas PyBadger, it's already initiated it and it returns as pixels (as stated in the docs, but I had to see for myself)

Anyhoo, in the end, I modified the code in the end and it all worked. 🙌

The docs were a bit all over the place, and if I didn't know how to go digging with my detective hat on, I would have been a little stuck. That's the only thing I can complain about it, lots of docs, but it's a mess. I'm also terrible ending down rabbit holes and forgetting what I was doing in the first place. 😅

End result

  • Press select button, the neopixels light up and goes through a rainbow sequence
  • Press down button, it dims the neopixels
  • Press up button, it brightens the neopixels
  • Press start button, it turns off the neopixels (also returns to original splash screen)
  • Press a button, opens the business card screen (Dublin Maker logo and my emai address)
  • Press b button, opens the QR code which links to dublinmaker.ie. And after years of hoarding lanyards from various conferences, I cobbled two lanyards and made it into one so I can hang my PyBadge. 🥰

Final note: This was in preparation for my talk back on Nov 22nd 2019 where I was on the closing plenary panel at the AWS Girls Tech Day in Explorium Sports & Science Centre. 🙌

Top comments (0)