forked from hybridgroup/gobot
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: go fmt files that needed it from recent changes
Signed-off-by: deadprogram <[email protected]>
- Loading branch information
1 parent
94d78d7
commit 3540ce7
Showing
20 changed files
with
128 additions
and
128 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,7 +20,7 @@ func main() { | |
}) | ||
}) | ||
|
||
drone.HullProtection(true) | ||
drone.HullProtection(true) | ||
drone.TakeOff() | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,35 @@ | ||
package main | ||
|
||
import ( | ||
"github.com/hybridgroup/gobot" | ||
"github.com/hybridgroup/gobot/platforms/gpio" | ||
"github.com/hybridgroup/gobot/platforms/intel-iot/edison" | ||
"github.com/hybridgroup/gobot" | ||
"github.com/hybridgroup/gobot/platforms/gpio" | ||
"github.com/hybridgroup/gobot/platforms/intel-iot/edison" | ||
) | ||
|
||
func main() { | ||
gbot := gobot.NewGobot() | ||
gbot := gobot.NewGobot() | ||
|
||
e := edison.NewEdisonAdaptor("edison") | ||
e := edison.NewEdisonAdaptor("edison") | ||
|
||
button := gpio.NewButtonDriver(e, "myButton", "2") | ||
led := gpio.NewLedDriver(e, "myLed", "4") | ||
button := gpio.NewButtonDriver(e, "myButton", "2") | ||
led := gpio.NewLedDriver(e, "myLed", "4") | ||
|
||
work := func() { | ||
button.On(gpio.ButtonPush, func(data interface{}) { | ||
led.On() | ||
}) | ||
button.On(gpio.ButtonRelease, func(data interface{}) { | ||
led.Off() | ||
}) | ||
} | ||
work := func() { | ||
button.On(gpio.ButtonPush, func(data interface{}) { | ||
led.On() | ||
}) | ||
button.On(gpio.ButtonRelease, func(data interface{}) { | ||
led.Off() | ||
}) | ||
} | ||
|
||
robot := gobot.NewRobot("buttonBot", | ||
[]gobot.Connection{e}, | ||
[]gobot.Device{led, button}, | ||
work, | ||
) | ||
robot := gobot.NewRobot("buttonBot", | ||
[]gobot.Connection{e}, | ||
[]gobot.Device{led, button}, | ||
work, | ||
) | ||
|
||
gbot.AddRobot(robot) | ||
gbot.AddRobot(robot) | ||
|
||
gbot.Start() | ||
gbot.Start() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,38 @@ | ||
package main | ||
|
||
import ( | ||
"github.com/hybridgroup/gobot" | ||
"github.com/hybridgroup/gobot/platforms/gpio" | ||
"github.com/hybridgroup/gobot/platforms/intel-iot/edison" | ||
"github.com/hybridgroup/gobot" | ||
"github.com/hybridgroup/gobot/platforms/gpio" | ||
"github.com/hybridgroup/gobot/platforms/intel-iot/edison" | ||
|
||
"github.com/hybridgroup/gobot/api" | ||
"github.com/hybridgroup/gobot/api" | ||
) | ||
|
||
func main() { | ||
gbot := gobot.NewGobot() | ||
api.NewAPI(gbot).Start() | ||
gbot := gobot.NewGobot() | ||
api.NewAPI(gbot).Start() | ||
|
||
e := edison.NewEdisonAdaptor("edison") | ||
e := edison.NewEdisonAdaptor("edison") | ||
|
||
button := gpio.NewButtonDriver(e, "myButton", "2") | ||
led := gpio.NewLedDriver(e, "myLed", "4") | ||
button := gpio.NewButtonDriver(e, "myButton", "2") | ||
led := gpio.NewLedDriver(e, "myLed", "4") | ||
|
||
work := func() { | ||
button.On(gpio.ButtonPush, func(data interface{}) { | ||
led.On() | ||
}) | ||
button.On(gpio.ButtonRelease, func(data interface{}) { | ||
led.Off() | ||
}) | ||
} | ||
work := func() { | ||
button.On(gpio.ButtonPush, func(data interface{}) { | ||
led.On() | ||
}) | ||
button.On(gpio.ButtonRelease, func(data interface{}) { | ||
led.Off() | ||
}) | ||
} | ||
|
||
robot := gobot.NewRobot("buttonBot", | ||
[]gobot.Connection{e}, | ||
[]gobot.Device{led, button}, | ||
work, | ||
) | ||
robot := gobot.NewRobot("buttonBot", | ||
[]gobot.Connection{e}, | ||
[]gobot.Device{led, button}, | ||
work, | ||
) | ||
|
||
gbot.AddRobot(robot) | ||
gbot.AddRobot(robot) | ||
|
||
gbot.Start() | ||
gbot.Start() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,4 +31,4 @@ func main() { | |
gbot.AddRobot(robot) | ||
|
||
gbot.Start() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
package main | ||
|
||
import ( | ||
"os" | ||
"fmt" | ||
"os" | ||
"time" | ||
|
||
"github.com/hybridgroup/gobot" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,46 @@ | ||
package main | ||
|
||
import ( | ||
"time" | ||
"time" | ||
|
||
"github.com/hybridgroup/gobot" | ||
"github.com/hybridgroup/gobot/api" | ||
"github.com/hybridgroup/gobot/platforms/sphero" | ||
"github.com/hybridgroup/gobot" | ||
"github.com/hybridgroup/gobot/api" | ||
"github.com/hybridgroup/gobot/platforms/sphero" | ||
) | ||
|
||
func main() { | ||
gbot := gobot.NewGobot() | ||
a := api.NewAPI(gbot) | ||
a.Start() | ||
|
||
conn := sphero.NewSpheroAdaptor("Sphero", "/dev/rfcomm0") | ||
ball := sphero.NewSpheroDriver(conn, "sphero") | ||
|
||
robot := gobot.NewRobot("sphero-dpad", | ||
[]gobot.Connection{conn}, | ||
[]gobot.Device{ball}, | ||
) | ||
|
||
robot.AddCommand("move", func(params map[string]interface{}) interface{} { | ||
direction := params["direction"].(string) | ||
|
||
switch direction { | ||
case "up": | ||
ball.Roll(100, 0) | ||
case "down": | ||
ball.Roll(100, 180) | ||
case "left": | ||
ball.Roll(100, 270) | ||
case "right": | ||
ball.Roll(100, 90) | ||
} | ||
|
||
time.Sleep(2 * time.Second) | ||
ball.Stop() | ||
return "ok" | ||
}) | ||
|
||
gbot.AddRobot(robot) | ||
|
||
gbot.Start() | ||
gbot := gobot.NewGobot() | ||
a := api.NewAPI(gbot) | ||
a.Start() | ||
|
||
conn := sphero.NewSpheroAdaptor("Sphero", "/dev/rfcomm0") | ||
ball := sphero.NewSpheroDriver(conn, "sphero") | ||
|
||
robot := gobot.NewRobot("sphero-dpad", | ||
[]gobot.Connection{conn}, | ||
[]gobot.Device{ball}, | ||
) | ||
|
||
robot.AddCommand("move", func(params map[string]interface{}) interface{} { | ||
direction := params["direction"].(string) | ||
|
||
switch direction { | ||
case "up": | ||
ball.Roll(100, 0) | ||
case "down": | ||
ball.Roll(100, 180) | ||
case "left": | ||
ball.Roll(100, 270) | ||
case "right": | ||
ball.Roll(100, 90) | ||
} | ||
|
||
time.Sleep(2 * time.Second) | ||
ball.Stop() | ||
return "ok" | ||
}) | ||
|
||
gbot.AddRobot(robot) | ||
|
||
gbot.Start() | ||
} |
Oops, something went wrong.