mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-04 19:17:47 +00:00
Remove microbit matrix (#319)
* Remove matrix code from bbc:microbit, and move it to a driver
This commit is contained in:
committed by
Ron Evans
parent
7e46c1766d
commit
fb952a722a
@@ -1,4 +1,4 @@
|
||||
// blink program for the BBC micro:bit that uses the entire LED matrix
|
||||
// blink program for the BBC micro:bit
|
||||
package main
|
||||
|
||||
import (
|
||||
@@ -6,14 +6,19 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
// The LED matrix in the micro:bit is a multiplexed display: https://en.wikipedia.org/wiki/Multiplexed_display
|
||||
// Driver for easier control: https://github.com/tinygo-org/drivers/tree/master/microbitmatrix
|
||||
func main() {
|
||||
machine.InitLEDMatrix()
|
||||
|
||||
ledrow := machine.GPIO{machine.LED_ROW_1}
|
||||
ledrow.Configure(machine.GPIOConfig{Mode: machine.GPIO_OUTPUT})
|
||||
ledcol := machine.GPIO{machine.LED_COL_1}
|
||||
ledcol.Configure(machine.GPIOConfig{Mode: machine.GPIO_OUTPUT})
|
||||
ledcol.Low()
|
||||
for {
|
||||
machine.ClearLEDMatrix()
|
||||
ledrow.Low()
|
||||
time.Sleep(time.Millisecond * 500)
|
||||
|
||||
machine.SetEntireLEDMatrixOn()
|
||||
ledrow.High()
|
||||
time.Sleep(time.Millisecond * 500)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user