To use them, watch this getting-started video (or scroll down for a text description):
Set up theenvironment
My TinyPICO boards came preloaded with MicroPython and some example code that cycles the onboard APA102 LED through the rainbow. However, you may need to install it from scratch, or update to a new version. First, download the binary: http://micropython.org/download#esp32
Also, make sure you have esptool installed: https://github.com/espressif/esptool
More in-depth info on setting up your environment and deploying new MicroPython firmware: https://docs.micropython.org/en/latest/esp32/tutorial/intro.html#deploying-the-firmware
To find the port your TinyPICO is on, type:
In my case, the port was: /dev/tty.SLAB_USBtoUART
The board talks to your computer over serial at a baud rate of 115200, so fire up a chat with it using screen:
screen /dev/tty.SLAB_USBtoUART 115200
You'll need to reset the board in order to see the info come up. (Before that, I had only a blinking cursor.) I grabbed a button and bent its legs inward to fit into the RST pin and its adjacent GND. Pressing the button to reset the board, I got this:
Hooray, I can talk to my board!
I'm especially excited to see battery info in here. I've soldered on the larger JST connector and plugged in a LiPo from my stash, and now I can be confident that it sees the battery—and is even checking for a full charge. Neato!
A weird thing happened for me at this point: I'm supposed to be able to talk to it over serial by hitting enter a few times, until I see a command prompt come up: >>>
However, this didn't happen for me, so I was unable to chat with my board. Boring!
So, I decided to try updating the firmware:
esptool.py --chip esp32 --port /dev/tty.SLAB_USBtoUART erase_flash
(First, I had to kill the screen session I had open, using: killall SCREEN)
Then, I flashed the most recent firmware binary, which I'd downloaded via this link:
esptool.py --chip esp32 --port /dev/tty.SLAB_USBtoUART --baud 460800 write_flash -z 0x1000 esp32-20190601-v1.11-10-g84f1067f7.bin
That did the trick! Firing up a new screen session, I got a bunch of gibberish, which was a bit scary, plus the onboard LED turned bright white – but after pushing the reset button, I got a shiny new command prompt! ✨
So obviously, this no longer has the preinstalled code running, and it also doesn't show the battery status. Boo. But, I can run arbitrary MicroPython code on my TinyPICO, straight from the command line – no uploading/downloading/etc. needed!
However, I do want to set this up as a standalone module, so I'll have to save files to it anyway. Unfortunately, we can't yet use Mu, which is a wonderful IDE for chatting with – and uploading code to – the Micro:bit, Circuit Playground Express, and more. In the Unexpected Maker video above, they recommend rshell, a remote shell tool for doing this stuff from the command line.
It's getting late, so I will update this tutorial soon with info on how to do that :) Thanks for reading!