Replace Safe functions with legacy.PinOutput

This commit is contained in:
Yurii Soldak
2025-09-21 10:04:20 +02:00
parent c6d83b783f
commit 453ff96a66
16 changed files with 112 additions and 108 deletions
+4 -1
View File
@@ -5,10 +5,13 @@ import (
"time"
"tinygo.org/x/drivers/hcsr04"
"tinygo.org/x/drivers/tinygo"
)
func main() {
sensor := hcsr04.New(machine.D10, machine.D9)
trigger := tinygo.New(machine.D10) // automatically configures pin as output
echo := tinygo.New(machine.D9) // automatically configures pin as input
sensor := hcsr04.New(trigger, echo)
sensor.Configure()
println("Ultrasonic starts")