Golang and the Arduino
Published in
3 min readJan 5, 2023
It is beyond me why we don’t give every child an Arduino Uno, and get them coding. Imagine the great engineers that we could create?
So, here’s my Arduino Uno:
And, as my favouriate programming language is Golang, there’s only thing for me to install first … Golang [here]:
And, as I have Macbbook, it’s an easy install:
$ brew tap tinygo-org/tools
$ brew install tinygo
$ brew tap osx-cross/avr
$ brew install avr-gcc
$ brew install avrdude
$ git clone --recursive https://github.com/tinygo-org/tinygo.git
$ cd tinygo
tinygo$ brew install llvm
tinygo$ go install
And so with the code of:
package main
// This is the most minimal blinky example and should run almost everywhere.
import (
"machine"
"time"
)
func main() {
led := machine.LED
led.Configure(machine.PinConfig{Mode: machine.PinOutput})
for {
led.Low()
time.Sleep(time.Millisecond * 500)led.High()
time.Sleep(time.Millisecond * 500)
}
}