Skip to content

Latest commit

 

History

History
41 lines (31 loc) · 1.06 KB

README.md

File metadata and controls

41 lines (31 loc) · 1.06 KB

Gopherbrick

ev3 provides EV3-specific functions for the Go ev3dev interface

Build Status Coverage Status GoDoc

github.com/ev3go/ev3 depends on an ev3dev kernel 4.4.9-11-ev3dev-ev3 or better.

Example code

package main

import (
	"log"
	"time"

	"github.com/ev3go/ev3"
)

func main() {
	var bright byte
	var err error
	for i := 0; i < 10; i++ {
		err = ev3.GreenLeft.SetBrightness(int(bright)).Err()
		if err != nil {
			log.Fatal(err)
		}
		time.Sleep(time.Second)

		bright = ^bright

		err = ev3.GreenRight.SetBrightness(int(bright)).Err()
		if err != nil {
			log.Fatal(err)
		}
		time.Sleep(time.Second)
	}
}

LEGO® is a trademark of the LEGO Group of companies which does not sponsor, authorize or endorse this software.