ev3

package module
v0.0.0-...-265c69c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 18, 2023 License: BSD-3-Clause Imports: 3 Imported by: 5

README

Gopherbrick

ev3 provides EV3-specific functions for the Go ev3dev interface

Build Status Coverage Status GoDoc

github.com/ev3go/ev3dev depends on ev3dev stretch. For jessie support see the ev3dev-jessie branch.

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.

Documentation

Overview

Package ev3 provides ev3-specific and higher level access to the ev3dev control and sensor drivers.

Index

Constants

View Source
const (
	// LCDWidth is the width of the LCD screen in pixels.
	LCDWidth = 178

	// LCDHeight is the height of the LCD screen in pixels.
	LCDHeight = 128

	// LCDStride is the width of the LCD screen memory in bytes.
	LCDStride = 712
)

Variables

View Source
var (
	GreenLeft  = &ev3dev.LED{Name: led{color: "green", side: "left"}}
	GreenRight = &ev3dev.LED{Name: led{color: "green", side: "right"}}
	RedLeft    = &ev3dev.LED{Name: led{color: "red", side: "left"}}
	RedRight   = &ev3dev.LED{Name: led{color: "red", side: "right"}}
)

LED handles for ev3 devices.

LCD is the draw image used draw directly to the ev3 LCD screen. Drawing operations are safe for concurrent use, but are not atomic beyond the pixel level. It must be initialized before use.

View Source
var Speaker = ev3dev.NewSpeaker("/dev/input/by-path/platform-snd-legoev3-event")

Speaker is a handle to the ev3 speaker. It must be initialized before use.

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL