github.com/tinygo-org/tinygo@v0.31.3-0.20240404173401-90b0bf646c27/src/examples/microbit-blink/microbit-blink.go (about) 1 // blink program for the BBC micro:bit 2 package main 3 4 import ( 5 "machine" 6 "time" 7 ) 8 9 // The LED matrix in the micro:bit is a multiplexed display: https://en.wikipedia.org/wiki/Multiplexed_display 10 // Driver for easier control: https://github.com/tinygo-org/drivers/tree/master/microbitmatrix 11 func main() { 12 ledrow := machine.LED_ROW_1 13 ledrow.Configure(machine.PinConfig{Mode: machine.PinOutput}) 14 ledcol := machine.LED_COL_1 15 ledcol.Configure(machine.PinConfig{Mode: machine.PinOutput}) 16 ledcol.Low() 17 for { 18 ledrow.Low() 19 time.Sleep(time.Millisecond * 500) 20 21 ledrow.High() 22 time.Sleep(time.Millisecond * 500) 23 } 24 }