Blink an LED - Tinygo Typing CST Test
Loading…
Blink an LED — Tinygo Code
Toggle an LED on pin 13 every 500 ms using TinyGo.
package main
import (
"machine"
"time"
)
func main() {
led := machine.D13
led.Configure(machine.PinConfig{Mode: machine.PinOutput})
for {
led.Toggle()
time.Sleep(500 * time.Millisecond)
}
}Tinygo Language Guide
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.
Primary Use Cases
- ▸Programming microcontrollers and IoT devices in Go
- ▸Compiling Go code to WebAssembly for web applications
- ▸Rapid prototyping of embedded hardware projects
- ▸Creating low-memory, low-power applications
- ▸Teaching and experimenting with Go on constrained hardware
Notable Features
- ▸Small runtime footprint optimized for microcontrollers
- ▸Cross-compilation to multiple architectures
- ▸Support for WebAssembly output
- ▸Integration with Arduino and other embedded boards
- ▸Subset of Go standard library tailored for constrained devices
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.