spark

package
v0.0.0-...-d941a39 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2014 License: Apache-2.0, Apache-2.0 Imports: 6 Imported by: 0

README

Spark

This package provides the Gobot adaptor for the Spark Core

Installing

go get github.com/hybridgroup/gobot && go install github.com/hybridgroup/platforms/spark

Example

package main

import (
        "github.com/hybridgroup/gobot"
        "github.com/hybridgroup/gobot/platforms/gpio"
        "github.com/hybridgroup/gobot/platforms/spark"
        "time"
)

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

        sparkCore := spark.NewSparkCoreAdaptor("spark", "device_id", "access_token")
        led := gpio.NewLedDriver(sparkCore, "led", "D7")

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

        master.Robots = append(master.Robots,
                gobot.NewRobot("spark", []gobot.Connection{sparkCore}, []gobot.Device{led}, work))

        master.Start()
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SparkCoreAdaptor

type SparkCoreAdaptor struct {
	gobot.Adaptor
	DeviceID    string
	AccessToken string
}

func NewSparkCoreAdaptor

func NewSparkCoreAdaptor(name string, deviceID string, accessToken string) *SparkCoreAdaptor

func (*SparkCoreAdaptor) AnalogRead

func (s *SparkCoreAdaptor) AnalogRead(pin string) float64

func (*SparkCoreAdaptor) AnalogWrite

func (s *SparkCoreAdaptor) AnalogWrite(pin string, level byte)

func (*SparkCoreAdaptor) Connect

func (s *SparkCoreAdaptor) Connect() bool

func (*SparkCoreAdaptor) DigitalRead

func (s *SparkCoreAdaptor) DigitalRead(pin string) int

func (*SparkCoreAdaptor) DigitalWrite

func (s *SparkCoreAdaptor) DigitalWrite(pin string, level byte)

func (*SparkCoreAdaptor) Finalize

func (s *SparkCoreAdaptor) Finalize() bool

func (*SparkCoreAdaptor) PwmWrite

func (s *SparkCoreAdaptor) PwmWrite(pin string, level byte)

Jump to

Keyboard shortcuts

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