What No One Tells You About TinyGo: Running Go on an Arduino Changed How I Think About Embedded Programming
When I first heard about TinyGo, I thought: “Cool, Go for microcontrollers... I doubt it’s practical.” Fast forward a month, and I’m blinking LEDs and handling button inputs with Go on my Arduino Uno — and loving every minute of it.
This blog post isn't just another overview — I'm diving deep into what it's actually like to work with TinyGo, what problems it solves (and doesn't), and how it changes the way you can think about embedded systems development. I'll walk you through a complete example with real code, compare the experience to classic Arduino C/C++, and share how switching to Go on microcontrollers made me a better developer both in the embedded world and fullstack web development.
Let’s set the scene.
Traditionally, embedded programming means clunky C code, opaque compilers, memory juggling, and lots of trial and error. Yes, it’s powerful, but the learning curve is steep and debugging is often a form of digital voodoo.
Here’s why TinyGo flips that on its head:
As a developer who is also working in web backend systems using Go, being able to reuse knowledge in the embedded space is cosmic-level productivity alignment.
Let’s look at how the same behavior (toggle an LED with a button press) is written in C vs Go.
const int buttonPin = 2; const int ledPin = 13; void setup() { pinMode(buttonPin, INPUT); pinMode(ledPin, OUTPUT); } void loop() { int buttonState = digitalRead(buttonPin); if (buttonState == HIGH) { digitalWrite(ledPin, HIGH); } else { digitalWrite(ledPin, LOW); } }
package main import ( "machine" "time" ) func main() { led := machine.LED button := machine.D2 // pin 2 led.Configure(machine.PinConfig{Mode: machine.PinOutput}) button.Configure(machine.PinConfig{Mode: machine.PinInput}) for { if button.Get() { led.High() } else { led.Low() } time.Sleep(10 * time.Millisecond) } }
What do you notice?
Setting up TinyGo is surprisingly smooth.
brew tap tinygo-org/tools brew install tinygo
Or grab it from the official downloads.
brew install avr-gcc
tinygo flash -target=arduino uno-led-blink.go
Your Arduino will restart and start running your compiled Go program! Yes — you’re running freaking statically compiled Go code on an 8-bit microcontroller!
Compare these code sizes:
How? TinyGo aggressively compiles only used packages/functions (leveraging Go's linker and escape analysis). And it's not some kind of toy language runtime — apps scale as you'd expect.
That same Go code can be compiled and run in the browser. Don’t believe me?
tinygo build -o main.wasm -target wasm yourfile.go
Then serve it using a web app and call Go functions from your JavaScript glue code. Same syntax, shared logic. It’s a dream come true for teams building fullstack web apps with heavy IOT integrations.
TinyGo opens the door to fully isomorphic Go codebases, spanning browser apps, backend REST services, and tiny embedded devices.
TinyGo isn’t a full Go implementation — it supports a major (and growing) subset of features:
But you still get:
Let's be honest, MicroPython is great — but performance is lacking. You don’t want to run real-time sensor loops with tight timing on a MicroPython interpreter.
Arduino C is fast, but unstructured, especially for larger programs.
TinyGo gives you:
Feature | Arduino C | MicroPython | TinyGo |
---|---|---|---|
Type Safe | ❌ | ✅ | ✅ |
Compile Speed | 😐 | ✅ (none) | ✅ |
Performance | ✅ | ❌ | ✅ |
WebAssembly | ❌ | ❌ | ✅ |
Modern Syntax | ❌ | ✅ | ✅ |
Absolutely — if you:
TinyGo is not just a developer toy — it’s a serious rethink in how we approach embedded development. It’s about time we started seeing microcontrollers as part of the modern dev stack, not some archaic island.
See the full TinyGo supported hardware list here.
Don’t just read this — write your first blinking LED in Go! It’ll change how you view the boundary between software and hardware.
Happy hacking!
💡 If you need help with bringing your idea to life or building embedded and web connected products using Go – we offer fullstack development.
Information