func newI2cTestAdaptor(name string) *i2cTestAdaptor { return &i2cTestAdaptor{ Adaptor: *gobot.NewAdaptor( name, "I2cTestAdaptor", ), } }
func newGpioTestAdaptor(name string) *gpioTestAdaptor { return &gpioTestAdaptor{ Adaptor: *gobot.NewAdaptor( name, "/dev/null", ), } }
func NewPebbleAdaptor(name string) *PebbleAdaptor { return &PebbleAdaptor{ Adaptor: *gobot.NewAdaptor( name, "PebbleAdaptor", ), } }
func NewSparkCoreAdaptor(name string, deviceID string, accessToken string) *SparkCoreAdaptor { return &SparkCoreAdaptor{ Adaptor: *gobot.NewAdaptor( name, "SparkCoreAdaptor", ), DeviceID: deviceID, AccessToken: accessToken, } }
func NewDigisparkAdaptor(name string) *DigisparkAdaptor { return &DigisparkAdaptor{ Adaptor: *gobot.NewAdaptor( name, "DigisparkAdaptor", ), connect: func(d *DigisparkAdaptor) { d.littleWire = LittleWireConnect() }, } }
func NewBeagleboneAdaptor(name string) *BeagleboneAdaptor { return &BeagleboneAdaptor{ Adaptor: *gobot.NewAdaptor( name, "BeagleboneAdaptor", ), connect: func() { ensureSlot("cape-bone-iio") ensureSlot("am33xx_pwm") }, } }
func NewArdroneAdaptor(name string) *ArdroneAdaptor { return &ArdroneAdaptor{ Adaptor: *gobot.NewAdaptor( name, "ArdroneAdaptor", ), connect: func(a *ArdroneAdaptor) { d, err := client.Connect(client.DefaultConfig()) if err != nil { panic(err) } a.drone = d }, } }
func NewNeuroskyAdaptor(name string, port string) *NeuroskyAdaptor { return &NeuroskyAdaptor{ Adaptor: *gobot.NewAdaptor( name, "NeuroskyAdaptor", port, ), connect: func(port string) io.ReadWriteCloser { sp, err := serial.OpenPort(&serial.Config{Name: port, Baud: 57600}) if err != nil { panic(err) } return sp }, } }
func NewJoystickAdaptor(name string) *JoystickAdaptor { return &JoystickAdaptor{ Adaptor: *gobot.NewAdaptor( name, "JoystickAdaptor", ), connect: func(j *JoystickAdaptor) { sdl.Init(sdl.INIT_JOYSTICK) if sdl.NumJoysticks() > 0 { j.joystick = sdl.JoystickOpen(0) } else { panic("No joystick available") } }, } }
func NewFirmataAdaptor(name, port string) *FirmataAdaptor { return &FirmataAdaptor{ Adaptor: *gobot.NewAdaptor( name, "FirmataAdaptor", port, ), connect: func(f *FirmataAdaptor) { sp, err := serial.OpenPort(&serial.Config{Name: f.Port(), Baud: 57600}) if err != nil { panic(err) } f.Board = newBoard(sp) }, } }
func NewSpheroAdaptor(name string, port string) *SpheroAdaptor { return &SpheroAdaptor{ Adaptor: *gobot.NewAdaptor( name, "SpheroAdaptor", port, ), connect: func(a *SpheroAdaptor) { c := &serial.Config{Name: a.Port(), Baud: 115200} s, err := serial.OpenPort(c) if err != nil { panic(err) } a.sp = s }, } }
func NewLeapMotionAdaptor(name string, port string) *LeapMotionAdaptor { return &LeapMotionAdaptor{ Adaptor: *gobot.NewAdaptor( name, "LeapMotionAdaptor", port, ), connect: func(l *LeapMotionAdaptor) { origin := fmt.Sprintf("http://%v", l.Port()) url := fmt.Sprintf("ws://%v/v3.json", l.Port()) ws, err := websocket.Dial(url, "", origin) if err != nil { panic(err) } l.ws = ws }, } }