https://tinygo.org/images/tinygo-logo.png
TinyGo是一个用于微控制器的Go编译器,使用WebAssembly(WASM)和命令行工具。
它重用了Go语言工具和LLVM一起使用的库,编译用Go编程语言编写的程序。
已经支持的硬件:
Adafruit Circuit Playground Express
Adafruit ItsyBitsy M0
Arduino Uno
BBC:Microbit
ST Micro STM32F103XX "Bluepill"
Digispark
Nordic Semiconductor PCA10031
Nordic Semiconductor PCA10040
Nordic Semiconductor PCA10056
Makerdiary nRF52840-MDK
Phytec reel board
项目网站
https://tinygo.org/
源码
https://github.com/tinygo-org/tinygo
编程示例
package main
import (
"machine"
"time"
)
func main() {
led := machine.GPIO{machine.LED}
led.Configure(machine.GPIOConfig{Mode: machine.GPIO_OUTPUT})
for {
led.Low()
time.Sleep(time.Millisecond * 1000)
led.High()
time.Sleep(time.Millisecond * 1000)
}
}