- Microcontroller: Anarduino MiniWireless RFM69-W-915.
- Programmer: Any 5V USB-FTDI bridge with the DTR pin exposed (I used SparkFun's FTDI Basic Breakout while working on it)
- Install Visual Studio Code
- Install the PlatformIO IDE extension from VSCode's Marketplace (Ctrl+P, then
ext install platformio.platformio-ide
) - Restart VSCode, give it time to update itself, then use PlatformIO's "Open Project" to load the project (it will automatically download and install the needed compiler toolchain)
- Follow any prompts from PlatformIO to ensure that your PC is able to communicate with the AVR programmer
- Plug the FTDI programmer into the board to be programmed, then connect the programmer to the PC
- From PlatformIO's sidebar panel, under "Project Tasks", select "Build" to compile, or "Upload" to compile and then program the board. You should see output like this:
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM: [========= ] 92.4% (used 1893 bytes from 2048 bytes)
Flash: [====== ] 59.6% (used 19210 bytes from 32256 bytes)
Configuring upload protocol...
AVAILABLE: arduino
CURRENT: upload_protocol = arduino
Looking for upload port...
Auto-detected: /dev/ttyUSB0
Uploading .pio/build/miniwireless/firmware.hex
avrdude: stk500_recv(): programmer is not responding avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x00
Then your programmer is not getting an answer from the chip it's trying to program. Ensure that it's plugged all the way in, and isn't connected backwards. Most boards have protection against reverse polarity, including these Anarduino ones, but not all engineers are fond of idiot-proofing things.
- All memory is allocated statically. Don't use
new
ormalloc
— declare larger objects globally so that static analysis can show you the amount of stack memory you have to play with. - Between RadioHead and the LED buffers, a good two-thirds of the controller's memory is already reserved, so all of the light patterns renderers are stateless. They render the output values deterministically, based on the passed-in
DrawState
which contains:- The current timestamp
- The timestamp of when the trigger was last pulled
- The timestamp of when the trigger was last released
- The current position of the joystick's X-axis