So I have used Go before a couple of years ago to build micro-services, took a course and all of that. And recently I’ve had the opportunity to use it again to setup an api server on a small device. The other framework I say was Gobot which was specially made for IoT and more in my line. It’s better to write it in Go than in C++ anyway. For this test I am using the Arduino Uno.

Installing TinyGo on Ubuntu (https://tinygo.org/getting-started/linux/):

Install the dependencies:

sudo apt-get install gcc-avr sudo apt-get install avr-libc sudo apt-get install avrdude

wget https://github.com/tinygo-org/tinygo/releases/download/v0.12.0/tinygo_0.12.0_amd64.deb sudo dpkg -i tinygo_0.12.0_amd64.deb You need to add the path:

export PATH=$PATH:/usr/local/tinygo/bin

or have it permanently in your terminal by adding it to your .bashrc file

Test the installation:

tinygo version

Run the go code as:

tinygo flash -target arduino blinkm.go

Installing gobot on Ubuntu (https://tinygo.org/getting-started/linux/):

You need to have Gort installed (https://gort.io/documentation/getting_started/downloads/):

gort scan serial This above command gives you the serial port address which is usually /dev/ttyACM0

gort arduino install

and don’t forget to upload the firmata protocol

gort arduino upload firmata /dev/ttyACM0

else you will end up with errors like this:

2020/02/27 11:41:23 Initializing connections... 2020/02/27 11:41:23 Initializing connection Firmata-29C44DEA10F63633 ... 2020/02/27 11:41:23 Initializing devices... 2020/02/27 11:41:23 Initializing device LED-3C3D1B7FE2D84FF6 ... 2020/02/27 11:41:23 Robot bot initialized. 2020/02/27 11:41:23 Starting Robot bot ... 2020/02/27 11:41:23 Starting connections... 2020/02/27 11:41:23 Starting connection Firmata-29C44DEA10F63633 on port /dev/ttyACM0... 2020/02/27 11:41:38 1 error occurred: * unable to connect. Perhaps you need to flash your Arduino with Firmata?