支持的型号
https://tinygo.org/docs/reference/microcontrollers/
1. 安装Go
2. 安装TinyGo,并添加环境变量
https://github.com/tinygo-org/tinygo/releases
3. VSCode配置,安装插件,选择设备
package main import ( "machine" "time" ) func main() { led := machine.LED led.Configure(machine.PinConfig{Mode: machine.PinOutput}) for { println("Hello, World") led.Low() time.Sleep(time.Millisecond * 500) led.High() time.Sleep(time.Millisecond * 500) } }
烧入代码
tinygo flash -target=nodemcu -port=COM8
效果:ESP8266LED闪烁,串口信息输出
编译bin
tinygo build -o firmware.bin -target=bluepill
STM32烧入
1. 安装STLink V2
2. 安装openocd
tinygo flash -target=stm32f4disco