Mode:
Duration:
1
Coding works best on desktop or with an external keyboard.
Coding works best on desktop or with an external keyboard.
Read a potentiometer on pin A0 and print the value to the serial console.
package main
import (
"machine"
"time"
"fmt"
)
func main() {
sensor := machine.ADC{Pin: machine.A0}
sensor.Configure()
for {
value := sensor.Get()
fmt.Println("Sensor value:", value)
time.Sleep(200 * 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.