gobot.io/x/gobot@v1.16.0/platforms/sphero/doc.go (about)

     1  /*
     2  Package sphero provides the Gobot adaptor and driver for the Sphero.
     3  
     4  Installing:
     5  
     6  	go get gobot.io/x/gobot/platforms/sphero
     7  
     8  Example:
     9  
    10  	package main
    11  
    12  	import (
    13  		"fmt"
    14  		"time"
    15  
    16  		"gobot.io/x/gobot"
    17  		"gobot.io/x/gobot/platforms/sphero"
    18  	)
    19  
    20  	func main() {
    21  		adaptor := sphero.NewAdaptor("/dev/rfcomm0")
    22  		driver := sphero.NewSpheroDriver(adaptor)
    23  
    24  		work := func() {
    25  			gobot.Every(3*time.Second, func() {
    26  				driver.Roll(30, uint16(gobot.Rand(360)))
    27  			})
    28  		}
    29  
    30  		robot := gobot.NewRobot("sphero",
    31  			[]gobot.Connection{adaptor},
    32  			[]gobot.Device{driver},
    33  			work,
    34  		)
    35  
    36  		robot.Start()
    37  	}
    38  
    39  For further information refer to sphero readme:
    40  https://github.com/hybridgroup/gobot/blob/master/platforms/sphero/README.md
    41  */
    42  package sphero // import "gobot.io/x/gobot/platforms/sphero"