Mode:
Duration:
1
Coding works best on desktop or with an external keyboard.
Coding works best on desktop or with an external keyboard.
Sweep a servo motor using PWM on pin D9.
package main
import (
"machine"
"time"
)
func main() {
servo := machine.D9
servo.Configure(machine.PinConfig{Mode: machine.PinPWM})
for {
for duty := 40; duty <= 115; duty += 5 {
servo.Set(duty)
time.Sleep(50 * time.Millisecond)
}
for duty := 115; duty >= 40; duty -= 5 {
servo.Set(duty)
time.Sleep(50 * time.Millisecond)
}
}
}TinyGo is a Go compiler designed for small devices, microcontrollers, WebAssembly, and other constrained environments. It enables developers to write Go code that can run efficiently on hardware with limited resources.
Origin & Creator
TinyGo was created by Jonathan Wright and contributors to extend the Go programming language to microcontrollers and WebAssembly in the 2010s.
Industrial Note
TinyGo is niche within embedded systems, IoT development, and WebAssembly applications where full Go runtime is too heavy or memory-limited devices are used.