edison

package
Version: v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2017 License: Apache-2.0, Apache-2.0 Imports: 8 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:

https://software.intel.com/en-us/iot/library/edison-getting-started

Don't forget to configure your Edison's wifi connection and flash your Edison with the latest firmware image!

The recommended way to connect to your device is via wifi, for that follow the directions here:

https://software.intel.com/en-us/connecting-your-intel-edison-board-using-wifi

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 can obtain the IP address of your Edison, by running the floowing command:

ip addr show | grep inet

Don't forget to setup the a password for the device otherwise you won't be able to connect using SSH. From within the screen session, run the following command:

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"

	"gobot.io/x/gobot"
	"gobot.io/x/gobot/drivers/gpio"
	"gobot.io/x/gobot/platforms/intel-iot/edison"
)

func main() {
	e := edison.NewAdaptor()
	led := gpio.NewLedDriver(e, "13")

	// Uncomment the line below if you are using a Sparkfun
	// Edison board with the GPIO block
	// e.SetBoard("sparkfun")

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

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

	robot.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).

License

Copyright (c) 2014-2017 The Hybrid Group. Licensed under the Apache 2.0 license.

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 Adaptor added in v1.0.0

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

Adaptor represents a Gobot Adaptor for an Intel Edison

func NewAdaptor added in v1.0.0

func NewAdaptor() *Adaptor

NewAdaptor returns a new Edison Adaptor

func (*Adaptor) AnalogRead added in v1.0.0

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

AnalogRead returns value from analog reading of specified pin

func (*Adaptor) Board added in v1.0.0

func (e *Adaptor) Board() string

Board returns the Adaptors board name

func (*Adaptor) Connect added in v1.0.0

func (e *Adaptor) Connect() (err error)

Connect initializes the Edison for use with the Arduino beakout board

func (*Adaptor) DigitalRead added in v1.0.0

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

DigitalRead reads digital value from pin

func (*Adaptor) DigitalWrite added in v1.0.0

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

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

func (*Adaptor) Finalize added in v1.0.0

func (e *Adaptor) Finalize() (err error)

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

func (*Adaptor) GetConnection added in v1.2.0

func (e *Adaptor) GetConnection(address int, bus int) (connection i2c.Connection, err error)

GetConnection returns an i2c connection to a device on a specified bus. Valid bus numbers are 1 and 6 (arduino).

func (*Adaptor) GetDefaultBus added in v1.2.0

func (e *Adaptor) GetDefaultBus() int

GetDefaultBus returns the default i2c bus for this platform

func (*Adaptor) Name added in v1.0.0

func (e *Adaptor) Name() string

Name returns the Adaptors name

func (*Adaptor) PwmWrite added in v1.0.0

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

PwmWrite writes the 0-254 value to the specified pin

func (*Adaptor) SetBoard added in v1.0.0

func (e *Adaptor) SetBoard(n string)

SetBoard sets the Adaptors name

func (*Adaptor) SetName added in v1.0.0

func (e *Adaptor) SetName(n string)

SetName sets the Adaptors name

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL