mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-07 12:33:42 +00:00
examples: clean up examples and add blinky1 for Arduino
Arduino has trouble supporting anything that's not extremely simple, so add a simple blinky example for it. Also, it may be useful anyway.
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
package main
|
||||
|
||||
// This is the most minimal blinky example and should run almost everywhere.
|
||||
|
||||
import (
|
||||
"machine"
|
||||
"runtime"
|
||||
)
|
||||
|
||||
func main() {
|
||||
led := machine.GPIO{machine.LED}
|
||||
led.Configure(machine.GPIOConfig{Mode: machine.GPIO_OUTPUT})
|
||||
for {
|
||||
led.Low()
|
||||
runtime.Sleep(runtime.Millisecond * 500)
|
||||
|
||||
led.High()
|
||||
runtime.Sleep(runtime.Millisecond * 500)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user