Flashing deploys a TinyGo program to a microcontroller so it becomes the program the device runs. It is the step that takes a compiled hardware application from the computer to the board. You can try the same workflow first with a virtual board in the TinyGo playground. section 12.3.3 section 12.3
Try a blinking LED before using hardware
Select an Arduino Nano 33 IoT at https://play.tinygo.org, paste a program that configures machine.LED as machine.PinOutput and repeatedly calls High(), sleeps, calls Low(), and sleeps again. Click Flash and watch the virtual orange LED blink. Changing to a Phytec reel board provides a useful check: this program will not blink there because machine.LED is not defined for that platform. section 12.3.1
To flash a physical Arduino Nano 33 IoT:
- Connect the board to the computer by USB. section 12.3.3
- Find its port: try `ls /dev/ttyUSB* /dev/ttyACM*` on Linux or `ls /dev/tty.*` on macOS; on Windows, inspect Ports (COM & LPT) in Device Manager. section 12.3.3
- Run `tinygo flash -target=arduino-nano33 -port=/dev/ttyUSB0`, replacing the example port with the one you found. The target option handles the required build tags. section 12.3.3
Listing 12.23 targets/arduino-nano33.json: Target specifications
{
"inherits": ["atsamd21g18a"], #1
"build-tags": ["arduino_nano33"], #2
"flash-command": "bossac -i -e -w -v -R -U --port={port} #3
--offset=0x2000 {bin}", #3
"serial-port": ["acm:2341:8057", "acm:2341:0057"], #3
"flash-1200-bps-reset": "true" #3
}
The Arduino Nano 33 IoT target specification shows why selecting a target matters: it supplies build tags, serial-port identifiers, a reset setting, and a flash command. section 12.3.1
After flashing, the board runs the newly deployed program. Unplugging it and supplying power elsewhere makes it run that program again. For an LED application, an internal LED may blink during flashing; check the program’s behavior afterward rather than treating that blink as its output. section 12.3.3
