以下をpicoで実験した どうもpicowのledモジュールがおかしい。。。。
// Toggle the LED.
const { LED } = require('led');
const led = new LED(28); // LED connected to pin 0.
led.on();
delay(1000); // wait for 1sec
led.off();
delay(1000); // wait for 1sec
led.toggle(); // on
delay(1000); // wait for 1sec
led.toggle(); // off
ーーーーーーーーtinygoならPICOW OKーーーーーーーーーーーーーーーーーーー
tinygo flash -target=pico-w main.go うまくいかんときはpicowをブートモードでやる!
package main
import (
"machine"
"time"
)
func main() {
led := machine.GPIO28
led.Configure(machine.PinConfig{Mode: machine.PinOutput})
for {
led.High() // ON
time.Sleep(1 * time.Second)
led.Low() // OFF
time.Sleep(1 * time.Second)
}
}
ーーーーーーーーー
tinygo target=arduino main.gで
package main
import (
"machine"
"time"
)
func main() {
led := machine.LED
led.Configure(machine.PinConfig{Mode: machine.PinOutput})
for {
led.Low()
time.Sleep(time.Millisecond * 900)
led.High()
time.Sleep(time.Millisecond * 500)
}
}
