Categories
Microcontrollers

Visual Studio Code (IDE) for TinyGO

Install the Go extension using the VSC’s Extensions

Install all dependencies

By hitting Ctrl + Shift + P and entering the following command

Go: install

Select all dependencies by checking the box on the left side and click OK. Wait till the log message appears as follows: All tools were successfully installed. You are ready to Go :).

Install TinyGo extentions

Configure TinyGo extension

TinyGo target set to Arduino

Sometimes a popup similar to the one in the following screenshot will appear. Do not click on Update tools; just close it.

Checking the Environment

tinygo info arduino

Write the Hello World code (Go lang)

package main

import (
   "machine"
   "time"
)

func main() {
   led:= machine.LED
   led.Configure(machine.PinConfig{Mode: machine.PinOutput})
   for {
      led.LOW()
      timeSleep(time.Millisecond * 300)
      led.HIGH()
      time.Sleep(time.Millisecond * 300)
   }
}

Flashing the program

tinygo flash –target=arduino main.go

Result

LED blink at Digital pin 13