Skip to content

Latest commit

 

History

History
57 lines (43 loc) · 1.26 KB

README.md

File metadata and controls

57 lines (43 loc) · 1.26 KB

goduino

Go's package for Arduino

Goduino uses Firmata protocol for Arduino

GoDoc

Prerequisites

  1. Download and install the Arduio IDE
  2. Plug in your Arduino via USB
  3. Open the Arduino IDE and open: File > Examples > StandardFirmata
  4. Select Arduino´s board: Tools > Board
  5. Select Arduino´s serial port: Tools > Serial Port
  6. Click the Upload button

Installation

	go get github.com/argandas/goduino

Usage

package main

import (
	"fmt"
	"github.com/argandas/goduino"
	"time"
)

func main() {
	arduino := goduino.New("myArduino", "COM1")
	err := arduino.Connect()
	if err != nil {
		fmt.Println(err)
		return
	}
	defer arduino.Disconnect()
	
	arduino.PinMode(13, goduino.Output)
	for {
		arduino.DigitalWrite(13, 1)
		arduino.Delay(time.Millisecond * 500)
		arduino.DigitalWrite(13, 0)
		arduino.Delay(time.Millisecond * 500)
	}
}

Note: For this example the selected serial port is COM1, be sure your Arduino is connected on this serial port.

Stable versions

This package has been tested on Go v1.4.2 & Firmata v2.4