Arduino Uno
tinogo-windows开发环境配置
https://tinygo.org/getting-started/install/windows/
scoop install go
scoop install tinygo
scoop install avrdude
windows烧写程序
tinygo flash -monitor -baudrate=9600 -target arduino -port COMX /path/to/blinky1
macos烧写程序
tinygo flash --target arduino -port /dev/cu.usbserial-0001 ./blinking.go
Microcontroller
Arduino Uno 使用的是ATmega328p 控制器
支持的外设接口:
- GPIO:general-purpose input/output,数字接口
- UART:Universal asynchronous receiver-transmitter,异步串行接口
- SPI:Serial Peripheral Interface,同步串行接口
- I2C:Inter-Integrated Circuit, 同步串行接口
- ADC:Analog-to-digital, 模拟转数字接口
- PWM: Pulse-width modulation,
- USB:不支持,异步串行接口
machine 包
machine包是tinygo中核心包
Driver
https://tinygo.org/docs/reference/devices/
安装支持的driver
go get tinygo.org/x/drivers