What happens when you put an ARM M3 with sensors, servors and LEDs in a kids twilight turtle? Let’s find out!
You can download Maple IDE for your operating system, the install it.
First use the Arduino based IDE to build code and update the turtle.
Load the code techno.pde
in the IDE
Under Tools -> Board choose LeafLabs Maple Rev3+ to Flash
Click the play button or hit ctrl-r
to build the code. This doesn’t upload to the turtle..
Click the upload button or hit ctrl-u
to flash the turtle. It will
rebuild the code if needed, so you don’t actually need to compile
unless you are looking for compile errors.
In the console you will eventually see something like:
Binary sketch size is reported above. Check it against a 108000 byte maximum. Loading via dfu-util Resetting to bootloader via DTR pulse Reset via USB Serial Failed! Did you select the serial right serial port? Assuming the board is in perpetual bootloader mode and continuing to attempt dfu programming... Searching for DFU device [1EAF:0003]...
At this point you need to find the reset button on the board and press it. At which point the ide tells you:
Found it!
A few seconds later the turtle will be running your code!
For now we won’t use a unix toolchain, because it didn’t work for me. But we can vastly improve our flow by only using the IDE to build/upload.
In MapleIDE prefrences, choose Use external editor.
Our new workflow is:
- edit code in emacs, save
- alt-tab to MapleIDE and press
ctrl-u
to compile and upload - wait for the upload to start and reset the turtle (entering bootload mode)
Luckily the board supports serial usb for logging!
It is ”slow” but for debugging it is very useful.
To access it from my computer I use screen
screen /dev/cu.usbmodem1421
Then anytime my code runs SerialUSB.println("string here");
You
will see a line of text in your screen session.
pixel values are GRB
Homebrew has dfu-util. make install
from the tutorial failed to
flash though.
It sucks to have press reset on the turtle to flash it. If only my computer could trigger reset/flash?
Right now I’ve made it so pressing shell and green buttons will cause a reset. Which is better than flipping the turtle over and finding the tiny reset button on the board.
how do I use
screen is great except it goes away when turtle is re-flashed..
also does the port change? /dev/cu.usbmodem1421
having everything in a single file is becoming annoying
I’ve started splitting into .h and .pde files for use with the IDE, using notes from forums.
xbee? bluetooth?
can I flash it and get Serial USB without wires?