edison

package
v0.12.1 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2016 License: Apache-2.0, Apache-2.0 Imports: 7 Imported by: 0

README

Edison

The Intel Edison is a wifi and Bluetooth® enabled devolopment platform for the Internet of Things. It packs a robust set of features into its small size and supports a broad spectrum of I/O and software support.

For more info about the Edison platform click here.

How to Install (using Go 1.5+)

Install Go from source or use an official distribution.

Then you must install the appropriate Go packages

Setting up your Intel Edison

Everything you need to get started with the Edison is in the Intel Getting Started Guide located here. Don't forget to configure your Edison's wifi connection and flash your Edison with the latest firmware image!

If you followed the Edison setup steps you should be all set to access your device using its wifi IP. Just in case you were too eager to get started, here are the critical parts you can't skip!

Connect to your device via USB so you can setup the network.

The recommended way to connect to your device is via wifi, for that follow the Intel directions so you can get your device to connect to your local wifi network and get its IP. If you don't have a wifi network available, the Intel documentation explains how to use another connection type, but note that this guide assumes you are using wifi connection.

You should get the ip of your edison as a message looking like that:

Please connect your laptop or PC to the same network as this device and go to http://10.35.15.185 or http://edison.local in your browser.

Don't forget to setup the a password for the device otherwise you won't be able to connect. From within the screen session:

configure_edison --password

Note that you MUST setup a password otherwise SSH won't be enabled. If later on you aren't able to scp to the device, try to reset the password. This password will obviously be needed next time you connect to your device.

Example program

Save the following code into a file called main.go.

package main

import (
	"time"

	"github.com/hybridgroup/gobot"
	"github.com/hybridgroup/gobot/platforms/gpio"
	"github.com/hybridgroup/gobot/platforms/intel-iot/edison"
)

func main() {
	gbot := gobot.NewGobot()

	e := edison.NewEdisonAdaptor("edison")
	led := gpio.NewLedDriver(e, "led", "13")

	work := func() {
		gobot.Every(1*time.Second, func() {
			led.Toggle()
		})
	}

	robot := gobot.NewRobot("blinkBot",
		[]gobot.Connection{e},
		[]gobot.Device{led},
		work,
	)

	gbot.AddRobot(robot)

	gbot.Start()
}

You can read the full API documentation online.

Cross compiling for the Intel Edison

Compile your Gobot program run the following command using the command line from the directory where you have your main.go file:

$ GOARCH=386 GOOS=linux go build .

Then you can simply upload your program over the network from your host computer to the Edison

$ scp main root@<IP of your device>:/home/root/blink

and execute it on your Edison (use screen to connect, see the Intel setup steps if you don't recall how to connect)

$ ./blink

At this point you should see the onboard led blinking. Press control + c to exit.

To update the program after you made a change, you will need to scp it over once again and start it from the command line (via screen).

Documentation

Overview

Package edison contains the Gobot adaptor for the Intel Edison.

For further information refer to intel-iot README: https://github.com/hybridgroup/gobot/blob/master/platforms/intel-iot/edison/README.md

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EdisonAdaptor

type EdisonAdaptor struct {
	// contains filtered or unexported fields
}

EdisonAdaptor represents an Intel Edison

func NewEdisonAdaptor

func NewEdisonAdaptor(name string) *EdisonAdaptor

NewEdisonAdaptor returns a new EdisonAdaptor with specified name

func (*EdisonAdaptor) AnalogRead

func (e *EdisonAdaptor) AnalogRead(pin string) (val int, err error)

AnalogRead returns value from analog reading of specified pin

func (*EdisonAdaptor) Connect

func (e *EdisonAdaptor) Connect() (errs []error)

Connect initializes the Edison for use with the Arduino beakout board

func (*EdisonAdaptor) DigitalRead

func (e *EdisonAdaptor) DigitalRead(pin string) (i int, err error)

DigitalRead reads digital value from pin

func (*EdisonAdaptor) DigitalWrite

func (e *EdisonAdaptor) DigitalWrite(pin string, val byte) (err error)

DigitalWrite writes a value to the pin. Acceptable values are 1 or 0.

func (*EdisonAdaptor) Finalize

func (e *EdisonAdaptor) Finalize() (errs []error)

Finalize releases all i2c devices and exported analog, digital, pwm pins.

func (*EdisonAdaptor) I2cRead

func (e *EdisonAdaptor) I2cRead(address int, size int) (data []byte, err error)

I2cRead returns size bytes from the i2c device

func (*EdisonAdaptor) I2cStart

func (e *EdisonAdaptor) I2cStart(address int) (err error)

I2cStart initializes i2c device for addresss

func (*EdisonAdaptor) I2cWrite

func (e *EdisonAdaptor) I2cWrite(address int, data []byte) (err error)

I2cWrite writes data to i2c device

func (*EdisonAdaptor) Name

func (e *EdisonAdaptor) Name() string

Name returns the EdisonAdaptors name

func (*EdisonAdaptor) PwmWrite

func (e *EdisonAdaptor) PwmWrite(pin string, val byte) (err error)

PwmWrite writes the 0-254 value to the specified pin

Jump to

Keyboard shortcuts

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