joule

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2016 License: Apache-2.0, Apache-2.0 Imports: 6 Imported by: 0

README

Edison

The Intel Joule is a wifi and Bluetooth® enabled development platform for the Internet of Things.

For more info about the Intel Joule platform go to:

http://www.intel.com/joule

Setting up your Intel Joule

Everything you need to get started with the Joule is in the Intel Getting Started Guide located at:

https://intel.com/joule/getstarted

Don't forget to configure your Joule's wifi connection and update your Joule to the latest firmware image!

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/joule"
)

func main() {
	e := joule.NewAdaptor()
	led := gpio.NewLedDriver(e, "103")

	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 Joule

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 Joule

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

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

$ ./blink

At this point you should see one of the onboard LEDs 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).

Pin Mapping

The Gobot pin mapping for the Intel Joule uses the same numbering as the MRAA library does, as documented here:

https://software.intel.com/en-us/pin-mapping-for-carrier-board-joule

Of special note are the pins that control the build-in LEDs, which are pins 100 thru 103, as used in the example above.

The i2c interfaces on the Intel Joule developer kit board require that you terminate the SDA & SCL lines using 2 10K resistors pulled up to the voltage used for the i2c device, for example 5V.

License

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

Documentation

Overview

Package joule contains the Gobot adaptor for the Intel Joule.

For further information refer to intel-iot README: https://gobot.io/x/gobot/blob/master/platforms/intel-iot/joule/README.md

Package joule pwm implementation

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 an Intel Joule

func NewAdaptor added in v1.0.0

func NewAdaptor() *Adaptor

NewAdaptor returns a new Joule Adaptor

func (*Adaptor) Connect added in v1.0.0

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

Connect initializes the Joule 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 digital and pwm pins.

func (*Adaptor) I2cRead added in v1.0.0

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

I2cRead returns size bytes from the i2c device

func (*Adaptor) I2cStart added in v1.0.0

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

I2cStart initializes i2c device for addresss

func (*Adaptor) I2cWrite added in v1.0.0

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

I2cWrite writes data to i2c device

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) 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
y or Y : Canonical URL