TinyGo:使用golang 开发硬件设备控制,调用gpio,spi,i2c,avr等协议

前言


本文的原文连接是:
https://blog.csdn.net/freewebsys/article/details/81665552

未经博主允许不得转载。
博主地址是:http://blog.csdn.net/freewebsys

1,关于TinyGo


TinyGo是一个Go编译器,旨在用于微控制器,WebAssembly(WASM)和命令行工具等小型场景。它重用了Go语言工具和LLVM一起使用的库,以提供编译用Go编程语言编写的程序的另一种方法。

官网:
https://tinygo.org/
https://github.com/tinygo-org/tinygo

2,使用


package main

import (
    "machine"
    "time"
)

func main() {
    led := machine.LED
    led.Configure(machine.PinConfig{Mode: machine.PinOutput})
    for {
        led.Low()
        time.Sleep(time.Millisecond * 1000)

        led.High()
        time.Sleep(time.Millisecond * 1000)
    }
}

可以进行 esp32 的设备的开发。
不知道能不能烧录到 芯片上去呢。
https://github.com/andygeiss/esp32

3,总结


不知道这个以后会不会成为流行呢。
毕竟现在找个c开发的越来越少了,而且这个语法学起来费劲呢。
还是golang好。下周买个芯片研究下,看看能不能刷上。

tinygo flash -target arduino examples/blinky1

本文的原文连接是:
https://blog.csdn.net/freewebsys/article/details/81665552

博主地址是:https://blog.csdn.net/freewebsys

发布了624 篇原创文章 · 获赞 259 · 访问量 208万+

猜你喜欢

转载自blog.csdn.net/freewebsys/article/details/103919388