From 4230d2ab2f443f69db507888b7eb1f110b32c0be Mon Sep 17 00:00:00 2001 From: deadprogram Date: Tue, 18 Oct 2016 21:08:25 +0200 Subject: [PATCH] examples: remove Master unless needed for less code Signed-off-by: deadprogram --- examples/ardrone.go | 5 +---- examples/ardrone_face_tracking.go | 6 +----- examples/ardrone_ps3.go | 6 +----- examples/audio.go | 6 +----- examples/beaglebone_basic_direct_pin.go | 2 -- examples/beaglebone_blink.go | 6 +----- examples/beaglebone_blink_usr_led.go | 6 +----- examples/beaglebone_blinkm.go | 5 +---- examples/beaglebone_button.go | 6 ++---- examples/beaglebone_direct_pin.go | 6 +----- examples/beaglebone_led_brightness.go | 5 +---- .../beaglebone_led_brightness_with_analog_input.go | 6 +----- examples/beaglebone_makey_button.go | 6 +----- examples/beaglebone_servo.go | 5 +---- examples/bebop.go | 5 +---- examples/bebop_ps3.go | 6 +----- examples/bebop_ps3_video.go | 6 +----- examples/ble_battery.go | 6 +----- examples/ble_device_info.go | 6 +----- examples/chip_blink.go | 6 +----- examples/chip_button.go | 6 ++---- examples/chip_button_led.go | 6 ++---- examples/chip_grove_accelerometer.go | 6 +----- examples/chip_grove_lcd.go | 6 +----- examples/chip_mpu6050.go | 6 +----- examples/chip_wiichuck.go | 6 +----- examples/digispark_api.go | 9 ++++----- examples/digispark_blink.go | 6 +----- examples/digispark_led_brightness.go | 6 +----- examples/digispark_servo.go | 6 +----- examples/edison_blink.go | 6 +----- examples/edison_blink_without_all_gobot_framework.go | 4 +++- examples/edison_blinkm.go | 5 +---- examples/edison_button.go | 6 +----- examples/edison_button_led.go | 6 +----- examples/edison_button_led_api.go | 8 ++++---- examples/edison_grove_accelerometer.go | 6 +----- examples/edison_grove_blink.go | 6 +----- examples/edison_grove_button.go | 6 +----- examples/edison_grove_buzzer.go | 6 +----- examples/edison_grove_lcd.go | 6 +----- examples/edison_grove_led.go | 6 +----- examples/edison_grove_light_sensor.go | 6 +----- examples/edison_grove_piezo_vibration.go | 6 +----- examples/edison_grove_rotary_sensor.go | 6 +----- examples/edison_grove_sound_sensor.go | 6 +----- examples/edison_grove_temperature_sensor.go | 6 +----- examples/edison_grove_touch.go | 6 +----- examples/edison_led_brightness.go | 6 +----- examples/edison_led_brightness_with_analog_input.go | 6 +----- examples/edison_miniboard_grove_accelerometer.go | 6 +----- examples/edison_rgb_led.go | 6 +----- examples/every_done.go | 6 +----- examples/firmata_blink.go | 6 +----- examples/firmata_blink_api.go | 9 ++++----- examples/firmata_blinkm.go | 5 +---- examples/firmata_button.go | 6 +----- examples/firmata_buzzer.go | 6 +----- examples/firmata_cat_toy.go | 6 +----- examples/firmata_direct_pin.go | 6 +----- examples/firmata_hmc6352.go | 6 +----- examples/firmata_integration.go | 6 +----- examples/firmata_led_brightness.go | 6 +----- examples/firmata_led_brightness_with_analog_input.go | 6 +----- examples/firmata_lidarlite.go | 6 +----- examples/firmata_makey_button.go | 6 +----- examples/firmata_mma7660.go | 6 +----- examples/firmata_motor.go | 6 +----- examples/firmata_mpl115a2.go | 6 +----- examples/firmata_mpu6050.go | 6 +----- examples/firmata_rgb_led.go | 6 +----- examples/firmata_servo.go | 5 +---- examples/firmata_temp36.go | 6 +----- examples/firmata_travis.go | 12 +++++------- examples/firmata_wiichuck.go | 6 +----- examples/hello.go | 7 +------ examples/hello_api.go | 10 +++++----- examples/hello_api_auth.go | 10 +++++----- examples/joule_blink.go | 6 +----- examples/joule_blinkm.go | 5 +---- examples/joule_grove_lcd.go | 6 +----- examples/joule_leds.go | 6 +----- examples/joule_rgb_led.go | 6 +----- examples/joystick_ps3.go | 6 +----- examples/joystick_ps4.go | 6 +----- examples/joystick_xbox360.go | 6 +----- examples/keyboard.go | 6 +----- examples/leap_motion.go | 6 +----- examples/leap_motion_gestures.go | 6 +----- examples/leap_motion_hands.go | 6 +----- examples/leap_servos.go | 5 +---- examples/leap_sphero.go | 6 +----- examples/mavlink.go | 6 +----- examples/megapi_motor.go | 6 +----- examples/minidrone.go | 6 +----- examples/minidrone_ps3.go | 6 +----- examples/mqtt_firmata_blink.go | 6 +----- examples/mqtt_ping.go | 6 +----- examples/nats.go | 6 +----- examples/neurosky.go | 5 +---- examples/ollie.go | 6 +----- examples/ollie_roll.go | 6 +----- examples/opencv_face_detect.go | 6 +----- examples/opencv_window.go | 6 +----- examples/particle_api.go | 8 ++++---- examples/particle_blink.go | 6 +----- examples/particle_button.go | 6 +----- examples/particle_events.go | 6 +----- examples/particle_function.go | 6 +----- examples/particle_led_brightness.go | 6 +----- examples/particle_variable.go | 6 +----- examples/pebble.go | 8 ++++---- examples/pebble_accelerometer.go | 8 ++++---- examples/raspi_adafruit_dcmotor.go | 6 ++---- examples/raspi_adafruit_servo.go | 5 +---- examples/raspi_adafruit_stepper.go | 5 +---- examples/raspi_blink.go | 6 +----- examples/raspi_blinkm.go | 5 +---- examples/raspi_button.go | 6 ++---- examples/sphero.go | 6 +----- examples/sphero_api.go | 8 ++++---- examples/sphero_conways.go | 7 ++++--- examples/sphero_dpad.go | 8 ++++---- examples/sphero_master.go | 10 +++++----- examples/square.go | 8 ++++---- examples/square_fire.go | 8 ++++---- 126 files changed, 181 insertions(+), 597 deletions(-) diff --git a/examples/ardrone.go b/examples/ardrone.go index 455c404a9..9a98a68e1 100644 --- a/examples/ardrone.go +++ b/examples/ardrone.go @@ -8,8 +8,6 @@ import ( ) func main() { - gbot := gobot.NewMaster() - ardroneAdaptor := ardrone.NewAdaptor() drone := ardrone.NewDriver(ardroneAdaptor) @@ -27,7 +25,6 @@ func main() { []gobot.Device{drone}, work, ) - gbot.AddRobot(robot) - gbot.Start() + robot.Start() } diff --git a/examples/ardrone_face_tracking.go b/examples/ardrone_face_tracking.go index 5ef2a6d35..bd95d821a 100644 --- a/examples/ardrone_face_tracking.go +++ b/examples/ardrone_face_tracking.go @@ -16,8 +16,6 @@ import ( func main() { runtime.GOMAXPROCS(runtime.NumCPU()) - gbot := gobot.NewMaster() - _, currentfile, _, _ := runtime.Caller(0) cascade := path.Join(path.Dir(currentfile), "haarcascade_frontalface_alt.xml") window := opencv.NewWindowDriver() @@ -76,7 +74,5 @@ func main() { work, ) - gbot.AddRobot(robot) - - gbot.Start() + robot.Start() } diff --git a/examples/ardrone_ps3.go b/examples/ardrone_ps3.go index 53bd4ebe3..400da3bd7 100644 --- a/examples/ardrone_ps3.go +++ b/examples/ardrone_ps3.go @@ -15,8 +15,6 @@ type pair struct { } func main() { - gbot := gobot.NewMaster() - joystickAdaptor := joystick.NewAdaptor() stick := joystick.NewDriver(joystickAdaptor, "./platforms/joystick/configs/dualshock3.json", @@ -109,9 +107,7 @@ func main() { work, ) - gbot.AddRobot(robot) - - gbot.Start() + robot.Start() } func validatePitch(data float64, offset float64) float64 { diff --git a/examples/audio.go b/examples/audio.go index 6604eb9f3..e97a86b5f 100644 --- a/examples/audio.go +++ b/examples/audio.go @@ -8,8 +8,6 @@ import ( ) func main() { - gbot := gobot.NewMaster() - e := audio.NewAdaptor() laser := audio.NewDriver(e, "./examples/laser.mp3") @@ -25,7 +23,5 @@ func main() { work, ) - gbot.AddRobot(robot) - - gbot.Start() + robot.Start() } diff --git a/examples/beaglebone_basic_direct_pin.go b/examples/beaglebone_basic_direct_pin.go index c956bbe04..21d0d8952 100644 --- a/examples/beaglebone_basic_direct_pin.go +++ b/examples/beaglebone_basic_direct_pin.go @@ -6,9 +6,7 @@ import ( ) func main() { - // Use Gobot to control BeagleBone's digital pins directly - beagleboneAdaptor := beaglebone.NewAdaptor() gpioPin := gpio.NewDirectPinDriver(beagleboneAdaptor, "P9_12") diff --git a/examples/beaglebone_blink.go b/examples/beaglebone_blink.go index cb4691b9e..da8349f9f 100644 --- a/examples/beaglebone_blink.go +++ b/examples/beaglebone_blink.go @@ -9,8 +9,6 @@ import ( ) func main() { - gbot := gobot.NewMaster() - beagleboneAdaptor := beaglebone.NewAdaptor() led := gpio.NewLedDriver(beagleboneAdaptor, "P9_12") @@ -26,7 +24,5 @@ func main() { work, ) - gbot.AddRobot(robot) - - gbot.Start() + robot.Start() } diff --git a/examples/beaglebone_blink_usr_led.go b/examples/beaglebone_blink_usr_led.go index 4becb22e8..34479e4b8 100644 --- a/examples/beaglebone_blink_usr_led.go +++ b/examples/beaglebone_blink_usr_led.go @@ -9,8 +9,6 @@ import ( ) func main() { - gbot := gobot.NewMaster() - beagleboneAdaptor := beaglebone.NewAdaptor() led := gpio.NewLedDriver(beagleboneAdaptor, "usr0") @@ -26,7 +24,5 @@ func main() { work, ) - gbot.AddRobot(robot) - - gbot.Start() + robot.Start() } diff --git a/examples/beaglebone_blinkm.go b/examples/beaglebone_blinkm.go index a8728cf03..9ef803e57 100644 --- a/examples/beaglebone_blinkm.go +++ b/examples/beaglebone_blinkm.go @@ -10,7 +10,6 @@ import ( ) func main() { - gbot := gobot.NewMaster() beagleboneAdaptor := beaglebone.NewAdaptor() blinkm := i2c.NewBlinkMDriver(beagleboneAdaptor) @@ -31,7 +30,5 @@ func main() { work, ) - gbot.AddRobot(robot) - - gbot.Start() + robot.Start() } diff --git a/examples/beaglebone_button.go b/examples/beaglebone_button.go index 4d06f761f..46e9670ee 100644 --- a/examples/beaglebone_button.go +++ b/examples/beaglebone_button.go @@ -9,8 +9,6 @@ import ( ) func main() { - gbot := gobot.NewMaster() - beagleboneAdaptor := beaglebone.NewAdaptor() button := gpio.NewButtonDriver(beagleboneAdaptor, "P8_9") @@ -29,6 +27,6 @@ func main() { []gobot.Device{button}, work, ) - gbot.AddRobot(robot) - gbot.Start() + + robot.Start() } diff --git a/examples/beaglebone_direct_pin.go b/examples/beaglebone_direct_pin.go index 6d7597945..804e684cd 100644 --- a/examples/beaglebone_direct_pin.go +++ b/examples/beaglebone_direct_pin.go @@ -9,8 +9,6 @@ import ( ) func main() { - gbot := gobot.NewMaster() - beagleboneAdaptor := beaglebone.NewAdaptor() led := gpio.NewDirectPinDriver(beagleboneAdaptor, "P8_10") button := gpio.NewDirectPinDriver(beagleboneAdaptor, "P8_9") @@ -32,7 +30,5 @@ func main() { work, ) - gbot.AddRobot(robot) - - gbot.Start() + robot.Start() } diff --git a/examples/beaglebone_led_brightness.go b/examples/beaglebone_led_brightness.go index 847eba552..5c7813a61 100644 --- a/examples/beaglebone_led_brightness.go +++ b/examples/beaglebone_led_brightness.go @@ -9,7 +9,6 @@ import ( ) func main() { - gbot := gobot.NewMaster() beagleboneAdaptor := beaglebone.NewAdaptor() led := gpio.NewLedDriver(beagleboneAdaptor, "P9_14") @@ -32,7 +31,5 @@ func main() { work, ) - gbot.AddRobot(robot) - - gbot.Start() + robot.Start() } diff --git a/examples/beaglebone_led_brightness_with_analog_input.go b/examples/beaglebone_led_brightness_with_analog_input.go index ffbaa5f36..a77d446b7 100644 --- a/examples/beaglebone_led_brightness_with_analog_input.go +++ b/examples/beaglebone_led_brightness_with_analog_input.go @@ -9,8 +9,6 @@ import ( ) func main() { - gbot := gobot.NewMaster() - beagleboneAdaptor := beaglebone.NewAdaptor() sensor := gpio.NewAnalogSensorDriver(beagleboneAdaptor, "P9_33") led := gpio.NewLedDriver(beagleboneAdaptor, "P9_14") @@ -32,7 +30,5 @@ func main() { work, ) - gbot.AddRobot(robot) - - gbot.Start() + robot.Start() } diff --git a/examples/beaglebone_makey_button.go b/examples/beaglebone_makey_button.go index 877f330d8..dcdd45cda 100644 --- a/examples/beaglebone_makey_button.go +++ b/examples/beaglebone_makey_button.go @@ -9,8 +9,6 @@ import ( ) func main() { - gbot := gobot.NewMaster() - beagleboneAdaptor := beaglebone.NewAdaptor() button := gpio.NewMakeyButtonDriver(beagleboneAdaptor, "P8_9") @@ -30,7 +28,5 @@ func main() { work, ) - gbot.AddRobot(robot) - - gbot.Start() + robot.Start() } diff --git a/examples/beaglebone_servo.go b/examples/beaglebone_servo.go index d8d1cfece..661e234ec 100644 --- a/examples/beaglebone_servo.go +++ b/examples/beaglebone_servo.go @@ -10,7 +10,6 @@ import ( ) func main() { - gbot := gobot.NewMaster() beagleboneAdaptor := beaglebone.NewAdaptor() servo := gpio.NewServoDriver(beagleboneAdaptor, "P9_14") @@ -28,7 +27,5 @@ func main() { work, ) - gbot.AddRobot(robot) - - gbot.Start() + robot.Start() } diff --git a/examples/bebop.go b/examples/bebop.go index 4a23c0774..a19ddb198 100644 --- a/examples/bebop.go +++ b/examples/bebop.go @@ -8,8 +8,6 @@ import ( ) func main() { - gbot := gobot.NewMaster() - bebopAdaptor := bebop.NewAdaptor() drone := bebop.NewDriver(bebopAdaptor) @@ -29,7 +27,6 @@ func main() { []gobot.Device{drone}, work, ) - gbot.AddRobot(robot) - gbot.Start() + robot.Start() } diff --git a/examples/bebop_ps3.go b/examples/bebop_ps3.go index c4a6c504e..ebc804622 100644 --- a/examples/bebop_ps3.go +++ b/examples/bebop_ps3.go @@ -15,8 +15,6 @@ type pair struct { } func main() { - gbot := gobot.NewMaster() - joystickAdaptor := joystick.NewAdaptor() stick := joystick.NewDriver(joystickAdaptor, "./platforms/joystick/configs/dualshock3.json", @@ -121,9 +119,7 @@ func main() { work, ) - gbot.AddRobot(robot) - - gbot.Start() + robot.Start() } func validatePitch(data float64, offset float64) int { diff --git a/examples/bebop_ps3_video.go b/examples/bebop_ps3_video.go index 5d725f9da..b72aa816d 100644 --- a/examples/bebop_ps3_video.go +++ b/examples/bebop_ps3_video.go @@ -53,8 +53,6 @@ func ffmpeg() (stdin io.WriteCloser, stderr io.ReadCloser, err error) { } func main() { - gbot := gobot.NewMaster() - joystickAdaptor := joystick.NewAdaptor() stick := joystick.NewDriver(joystickAdaptor, "./platforms/joystick/configs/dualshock3.json", @@ -170,9 +168,7 @@ func main() { work, ) - gbot.AddRobot(robot) - - gbot.Start() + robot.Start() } func validatePitch(data float64, offset float64) int { diff --git a/examples/ble_battery.go b/examples/ble_battery.go index 7239f09bf..eadc9c198 100644 --- a/examples/ble_battery.go +++ b/examples/ble_battery.go @@ -10,8 +10,6 @@ import ( ) func main() { - gbot := gobot.NewMaster() - bleAdaptor := ble.NewClientAdaptor(os.Args[1]) battery := ble.NewBatteryDriver(bleAdaptor) @@ -27,7 +25,5 @@ func main() { work, ) - gbot.AddRobot(robot) - - gbot.Start() + robot.Start() } diff --git a/examples/ble_device_info.go b/examples/ble_device_info.go index 06870541e..b293738e0 100644 --- a/examples/ble_device_info.go +++ b/examples/ble_device_info.go @@ -9,8 +9,6 @@ import ( ) func main() { - gbot := gobot.NewMaster() - bleAdaptor := ble.NewClientAdaptor(os.Args[1]) info := ble.NewDeviceInformationDriver(bleAdaptor) @@ -28,7 +26,5 @@ func main() { work, ) - gbot.AddRobot(robot) - - gbot.Start() + robot.Start() } diff --git a/examples/chip_blink.go b/examples/chip_blink.go index 01f0e7af0..01de5f76b 100644 --- a/examples/chip_blink.go +++ b/examples/chip_blink.go @@ -9,8 +9,6 @@ import ( ) func main() { - gbot := gobot.NewMaster() - chipAdaptor := chip.NewAdaptor() led := gpio.NewLedDriver(chipAdaptor, "XIO-P0") @@ -26,7 +24,5 @@ func main() { work, ) - gbot.AddRobot(robot) - - gbot.Start() + robot.Start() } diff --git a/examples/chip_button.go b/examples/chip_button.go index 1976d21f6..dad4555d8 100644 --- a/examples/chip_button.go +++ b/examples/chip_button.go @@ -9,8 +9,6 @@ import ( ) func main() { - gbot := gobot.NewMaster() - chipAdaptor := chip.NewAdaptor() button := gpio.NewButtonDriver(chipAdaptor, "XIO-P0") @@ -29,6 +27,6 @@ func main() { []gobot.Device{button}, work, ) - gbot.AddRobot(robot) - gbot.Start() + + robot.Start() } diff --git a/examples/chip_button_led.go b/examples/chip_button_led.go index d18fe5b06..86f5b4407 100644 --- a/examples/chip_button_led.go +++ b/examples/chip_button_led.go @@ -7,8 +7,6 @@ import ( ) func main() { - gbot := gobot.NewMaster() - chipAdaptor := chip.NewAdaptor() button := gpio.NewButtonDriver(chipAdaptor, "XIO-P6") led := gpio.NewLedDriver(chipAdaptor, "XIO-P7") @@ -28,6 +26,6 @@ func main() { []gobot.Device{button, led}, work, ) - gbot.AddRobot(robot) - gbot.Start() + + robot.Start() } diff --git a/examples/chip_grove_accelerometer.go b/examples/chip_grove_accelerometer.go index 5099bc78c..d4d38c8c9 100644 --- a/examples/chip_grove_accelerometer.go +++ b/examples/chip_grove_accelerometer.go @@ -10,8 +10,6 @@ import ( ) func main() { - gbot := gobot.NewMaster() - board := chip.NewAdaptor() accel := i2c.NewGroveAccelerometerDriver(board) @@ -32,7 +30,5 @@ func main() { work, ) - gbot.AddRobot(robot) - - gbot.Start() + robot.Start() } diff --git a/examples/chip_grove_lcd.go b/examples/chip_grove_lcd.go index c7f809052..e9a598d1f 100644 --- a/examples/chip_grove_lcd.go +++ b/examples/chip_grove_lcd.go @@ -9,8 +9,6 @@ import ( ) func main() { - gbot := gobot.NewMaster() - board := chip.NewAdaptor() screen := i2c.NewGroveLcdDriver(board) @@ -43,7 +41,5 @@ func main() { work, ) - gbot.AddRobot(robot) - - gbot.Start() + robot.Start() } diff --git a/examples/chip_mpu6050.go b/examples/chip_mpu6050.go index 79a8680f8..9e515b24d 100644 --- a/examples/chip_mpu6050.go +++ b/examples/chip_mpu6050.go @@ -10,8 +10,6 @@ import ( ) func main() { - gbot := gobot.NewMaster() - board := chip.NewAdaptor() mpu6050 := i2c.NewMPU6050Driver(board) @@ -29,7 +27,5 @@ func main() { work, ) - gbot.AddRobot(robot) - - gbot.Start() + robot.Start() } diff --git a/examples/chip_wiichuck.go b/examples/chip_wiichuck.go index 71d0f894c..9772a54f7 100644 --- a/examples/chip_wiichuck.go +++ b/examples/chip_wiichuck.go @@ -9,8 +9,6 @@ import ( ) func main() { - gbot := gobot.NewMaster() - chipAdaptor := chip.NewAdaptor() wiichuck := i2c.NewWiichuckDriver(chipAdaptor) @@ -37,7 +35,5 @@ func main() { work, ) - gbot.AddRobot(robot) - - gbot.Start() + robot.Start() } diff --git a/examples/digispark_api.go b/examples/digispark_api.go index 62ca42449..703a73165 100644 --- a/examples/digispark_api.go +++ b/examples/digispark_api.go @@ -8,9 +8,8 @@ import ( ) func main() { - gbot := gobot.NewMaster() - - api.NewAPI(gbot).Start() + master := gobot.NewMaster() + api.NewAPI(master).Start() digisparkAdaptor := digispark.NewAdaptor() led := gpio.NewLedDriver(digisparkAdaptor, "0") @@ -20,7 +19,7 @@ func main() { []gobot.Device{led}, ) - gbot.AddRobot(robot) + master.AddRobot(robot) - gbot.Start() + master.Start() } diff --git a/examples/digispark_blink.go b/examples/digispark_blink.go index b86417c21..3d3f99e4d 100644 --- a/examples/digispark_blink.go +++ b/examples/digispark_blink.go @@ -9,8 +9,6 @@ import ( ) func main() { - gbot := gobot.NewMaster() - digisparkAdaptor := digispark.NewAdaptor() led := gpio.NewLedDriver(digisparkAdaptor, "0") @@ -26,7 +24,5 @@ func main() { work, ) - gbot.AddRobot(robot) - - gbot.Start() + robot.Start() } diff --git a/examples/digispark_led_brightness.go b/examples/digispark_led_brightness.go index 8f65bb304..6e2f81fdc 100644 --- a/examples/digispark_led_brightness.go +++ b/examples/digispark_led_brightness.go @@ -9,8 +9,6 @@ import ( ) func main() { - gbot := gobot.NewMaster() - digisparkAdaptor := digispark.NewAdaptor() led := gpio.NewLedDriver(digisparkAdaptor, "0") @@ -33,7 +31,5 @@ func main() { work, ) - gbot.AddRobot(robot) - - gbot.Start() + robot.Start() } diff --git a/examples/digispark_servo.go b/examples/digispark_servo.go index 7da03e1b0..e628c237a 100644 --- a/examples/digispark_servo.go +++ b/examples/digispark_servo.go @@ -10,8 +10,6 @@ import ( ) func main() { - gbot := gobot.NewMaster() - digisparkAdaptor := digispark.NewAdaptor() servo := gpio.NewServoDriver(digisparkAdaptor, "0") @@ -29,7 +27,5 @@ func main() { work, ) - gbot.AddRobot(robot) - - gbot.Start() + robot.Start() } diff --git a/examples/edison_blink.go b/examples/edison_blink.go index 3bba59cac..cf7141225 100644 --- a/examples/edison_blink.go +++ b/examples/edison_blink.go @@ -9,8 +9,6 @@ import ( ) func main() { - gbot := gobot.NewMaster() - e := edison.NewAdaptor() led := gpio.NewLedDriver(e, "13") @@ -26,7 +24,5 @@ func main() { work, ) - gbot.AddRobot(robot) - - gbot.Start() + robot.Start() } diff --git a/examples/edison_blink_without_all_gobot_framework.go b/examples/edison_blink_without_all_gobot_framework.go index 5263298f8..9ce320ff4 100644 --- a/examples/edison_blink_without_all_gobot_framework.go +++ b/examples/edison_blink_without_all_gobot_framework.go @@ -13,9 +13,11 @@ import ( // golang library to interact with sensors and other devices. func main() { e := edison.NewAdaptor() - led := gpio.NewLedDriver(e, "13") e.Connect() + + led := gpio.NewLedDriver(e, "13") led.Start() + for { led.Toggle() time.Sleep(1000 * time.Millisecond) diff --git a/examples/edison_blinkm.go b/examples/edison_blinkm.go index efb23a41e..483b95854 100644 --- a/examples/edison_blinkm.go +++ b/examples/edison_blinkm.go @@ -10,8 +10,6 @@ import ( ) func main() { - gbot := gobot.NewMaster() - e := edison.NewAdaptor() blinkm := i2c.NewBlinkMDriver(e) @@ -32,6 +30,5 @@ func main() { work, ) - gbot.AddRobot(robot) - gbot.Start() + robot.Start() } diff --git a/examples/edison_button.go b/examples/edison_button.go index 802ae56a0..cdfff7796 100644 --- a/examples/edison_button.go +++ b/examples/edison_button.go @@ -7,8 +7,6 @@ import ( ) func main() { - gbot := gobot.NewMaster() - e := edison.NewAdaptor() button := gpio.NewButtonDriver(e, "5") @@ -29,7 +27,5 @@ func main() { work, ) - gbot.AddRobot(robot) - - gbot.Start() + robot.Start() } diff --git a/examples/edison_button_led.go b/examples/edison_button_led.go index 41495df50..c19facdbe 100644 --- a/examples/edison_button_led.go +++ b/examples/edison_button_led.go @@ -7,8 +7,6 @@ import ( ) func main() { - gbot := gobot.NewMaster() - e := edison.NewAdaptor() button := gpio.NewButtonDriver(e, "2") @@ -29,7 +27,5 @@ func main() { work, ) - gbot.AddRobot(robot) - - gbot.Start() + robot.Start() } diff --git a/examples/edison_button_led_api.go b/examples/edison_button_led_api.go index 2d272fe2c..896d0da51 100644 --- a/examples/edison_button_led_api.go +++ b/examples/edison_button_led_api.go @@ -9,8 +9,8 @@ import ( ) func main() { - gbot := gobot.NewMaster() - api.NewAPI(gbot).Start() + master := gobot.NewMaster() + api.NewAPI(master).Start() e := edison.NewAdaptor() @@ -32,7 +32,7 @@ func main() { work, ) - gbot.AddRobot(robot) + master.AddRobot(robot) - gbot.Start() + master.Start() } diff --git a/examples/edison_grove_accelerometer.go b/examples/edison_grove_accelerometer.go index 31f094016..71d673b15 100644 --- a/examples/edison_grove_accelerometer.go +++ b/examples/edison_grove_accelerometer.go @@ -10,8 +10,6 @@ import ( ) func main() { - gbot := gobot.NewMaster() - board := edison.NewAdaptor() accel := i2c.NewGroveAccelerometerDriver(board) @@ -32,7 +30,5 @@ func main() { work, ) - gbot.AddRobot(robot) - - gbot.Start() + robot.Start() } diff --git a/examples/edison_grove_blink.go b/examples/edison_grove_blink.go index 3bba59cac..cf7141225 100644 --- a/examples/edison_grove_blink.go +++ b/examples/edison_grove_blink.go @@ -9,8 +9,6 @@ import ( ) func main() { - gbot := gobot.NewMaster() - e := edison.NewAdaptor() led := gpio.NewLedDriver(e, "13") @@ -26,7 +24,5 @@ func main() { work, ) - gbot.AddRobot(robot) - - gbot.Start() + robot.Start() } diff --git a/examples/edison_grove_button.go b/examples/edison_grove_button.go index 16453aad9..04d95e425 100644 --- a/examples/edison_grove_button.go +++ b/examples/edison_grove_button.go @@ -9,8 +9,6 @@ import ( ) func main() { - gbot := gobot.NewMaster() - e := edison.NewAdaptor() button := gpio.NewGroveButtonDriver(e, "2") @@ -31,7 +29,5 @@ func main() { work, ) - gbot.AddRobot(robot) - - gbot.Start() + robot.Start() } diff --git a/examples/edison_grove_buzzer.go b/examples/edison_grove_buzzer.go index 990d75c69..773103a42 100644 --- a/examples/edison_grove_buzzer.go +++ b/examples/edison_grove_buzzer.go @@ -9,8 +9,6 @@ import ( ) func main() { - gbot := gobot.NewMaster() - board := edison.NewAdaptor() buzzer := gpio.NewBuzzerDriver(board, "3") @@ -49,7 +47,5 @@ func main() { work, ) - gbot.AddRobot(robot) - - gbot.Start() + robot.Start() } diff --git a/examples/edison_grove_lcd.go b/examples/edison_grove_lcd.go index 1b53305ac..f4609c283 100644 --- a/examples/edison_grove_lcd.go +++ b/examples/edison_grove_lcd.go @@ -9,8 +9,6 @@ import ( ) func main() { - gbot := gobot.NewMaster() - board := edison.NewAdaptor() screen := i2c.NewGroveLcdDriver(board) @@ -43,7 +41,5 @@ func main() { work, ) - gbot.AddRobot(robot) - - gbot.Start() + robot.Start() } diff --git a/examples/edison_grove_led.go b/examples/edison_grove_led.go index 2250c8b91..c516f422b 100644 --- a/examples/edison_grove_led.go +++ b/examples/edison_grove_led.go @@ -9,8 +9,6 @@ import ( ) func main() { - gbot := gobot.NewMaster() - e := edison.NewAdaptor() led := gpio.NewGroveLedDriver(e, "4") @@ -26,7 +24,5 @@ func main() { work, ) - gbot.AddRobot(robot) - - gbot.Start() + robot.Start() } diff --git a/examples/edison_grove_light_sensor.go b/examples/edison_grove_light_sensor.go index 31cccf321..e9177861a 100644 --- a/examples/edison_grove_light_sensor.go +++ b/examples/edison_grove_light_sensor.go @@ -9,8 +9,6 @@ import ( ) func main() { - gbot := gobot.NewMaster() - board := edison.NewAdaptor() sensor := gpio.NewGroveLightSensorDriver(board, "0") @@ -26,7 +24,5 @@ func main() { work, ) - gbot.AddRobot(robot) - - gbot.Start() + robot.Start() } diff --git a/examples/edison_grove_piezo_vibration.go b/examples/edison_grove_piezo_vibration.go index e3557f1fe..a891dc200 100644 --- a/examples/edison_grove_piezo_vibration.go +++ b/examples/edison_grove_piezo_vibration.go @@ -9,8 +9,6 @@ import ( ) func main() { - gbot := gobot.NewMaster() - board := edison.NewAdaptor() sensor := gpio.NewGrovePiezoVibrationSensorDriver(board, "0") @@ -26,7 +24,5 @@ func main() { work, ) - gbot.AddRobot(robot) - - gbot.Start() + robot.Start() } diff --git a/examples/edison_grove_rotary_sensor.go b/examples/edison_grove_rotary_sensor.go index f136f00e4..a10e80536 100644 --- a/examples/edison_grove_rotary_sensor.go +++ b/examples/edison_grove_rotary_sensor.go @@ -9,8 +9,6 @@ import ( ) func main() { - gbot := gobot.NewMaster() - board := edison.NewAdaptor() sensor := gpio.NewGroveRotaryDriver(board, "0") @@ -26,7 +24,5 @@ func main() { work, ) - gbot.AddRobot(robot) - - gbot.Start() + robot.Start() } diff --git a/examples/edison_grove_sound_sensor.go b/examples/edison_grove_sound_sensor.go index 375f667bc..2eda3db94 100644 --- a/examples/edison_grove_sound_sensor.go +++ b/examples/edison_grove_sound_sensor.go @@ -9,8 +9,6 @@ import ( ) func main() { - gbot := gobot.NewMaster() - board := edison.NewAdaptor() sensor := gpio.NewGroveSoundSensorDriver(board, "0") @@ -26,7 +24,5 @@ func main() { work, ) - gbot.AddRobot(robot) - - gbot.Start() + robot.Start() } diff --git a/examples/edison_grove_temperature_sensor.go b/examples/edison_grove_temperature_sensor.go index 98b045c91..43fc474b0 100644 --- a/examples/edison_grove_temperature_sensor.go +++ b/examples/edison_grove_temperature_sensor.go @@ -10,8 +10,6 @@ import ( ) func main() { - gbot := gobot.NewMaster() - board := edison.NewAdaptor() sensor := gpio.NewGroveTemperatureSensorDriver(board, "0") @@ -27,7 +25,5 @@ func main() { work, ) - gbot.AddRobot(robot) - - gbot.Start() + robot.Start() } diff --git a/examples/edison_grove_touch.go b/examples/edison_grove_touch.go index 7f7f66a2c..f7132e503 100644 --- a/examples/edison_grove_touch.go +++ b/examples/edison_grove_touch.go @@ -9,8 +9,6 @@ import ( ) func main() { - gbot := gobot.NewMaster() - e := edison.NewAdaptor() touch := gpio.NewGroveTouchDriver(e, "2") @@ -31,7 +29,5 @@ func main() { work, ) - gbot.AddRobot(robot) - - gbot.Start() + robot.Start() } diff --git a/examples/edison_led_brightness.go b/examples/edison_led_brightness.go index 5af4b3f14..7735e01fc 100644 --- a/examples/edison_led_brightness.go +++ b/examples/edison_led_brightness.go @@ -9,8 +9,6 @@ import ( ) func main() { - gbot := gobot.NewMaster() - e := edison.NewAdaptor() led := gpio.NewLedDriver(e, "3") @@ -33,7 +31,5 @@ func main() { work, ) - gbot.AddRobot(robot) - - gbot.Start() + robot.Start() } diff --git a/examples/edison_led_brightness_with_analog_input.go b/examples/edison_led_brightness_with_analog_input.go index 84f995602..bfca7c42d 100644 --- a/examples/edison_led_brightness_with_analog_input.go +++ b/examples/edison_led_brightness_with_analog_input.go @@ -9,8 +9,6 @@ import ( ) func main() { - gbot := gobot.NewMaster() - e := edison.NewAdaptor() sensor := gpio.NewAnalogSensorDriver(e, "0") led := gpio.NewLedDriver(e, "3") @@ -32,7 +30,5 @@ func main() { work, ) - gbot.AddRobot(robot) - - gbot.Start() + master.Start() } diff --git a/examples/edison_miniboard_grove_accelerometer.go b/examples/edison_miniboard_grove_accelerometer.go index edf9a56bd..f26a879a3 100644 --- a/examples/edison_miniboard_grove_accelerometer.go +++ b/examples/edison_miniboard_grove_accelerometer.go @@ -10,8 +10,6 @@ import ( ) func main() { - gbot := gobot.NewMaster() - board := edison.NewAdaptor() board.SetBoard("miniboard") @@ -34,7 +32,5 @@ func main() { work, ) - gbot.AddRobot(robot) - - gbot.Start() + robot.Start() } diff --git a/examples/edison_rgb_led.go b/examples/edison_rgb_led.go index b12e04425..b26aa3a3b 100644 --- a/examples/edison_rgb_led.go +++ b/examples/edison_rgb_led.go @@ -9,8 +9,6 @@ import ( ) func main() { - gbot := gobot.NewMaster() - e := edison.NewAdaptor() led := gpio.NewRgbLedDriver(e, "3", "5", "6") @@ -29,7 +27,5 @@ func main() { work, ) - gbot.AddRobot(robot) - - gbot.Start() + robot.Start() } diff --git a/examples/every_done.go b/examples/every_done.go index 46a60fb25..c6c3a8a2c 100644 --- a/examples/every_done.go +++ b/examples/every_done.go @@ -8,8 +8,6 @@ import ( ) func main() { - gbot := gobot.NewMaster() - robot := gobot.NewRobot( "hello", func() { @@ -24,7 +22,5 @@ func main() { }, ) - gbot.AddRobot(robot) - - gbot.Start() + robot.Start() } diff --git a/examples/firmata_blink.go b/examples/firmata_blink.go index 47190e756..e27de4ce1 100644 --- a/examples/firmata_blink.go +++ b/examples/firmata_blink.go @@ -9,8 +9,6 @@ import ( ) func main() { - gbot := gobot.NewMaster() - firmataAdaptor := firmata.NewAdaptor("/dev/ttyACM0") led := gpio.NewLedDriver(firmataAdaptor, "13") @@ -26,7 +24,5 @@ func main() { work, ) - gbot.AddRobot(robot) - - gbot.Start() + robot.Start() } diff --git a/examples/firmata_blink_api.go b/examples/firmata_blink_api.go index 736e49f7a..c525e1a91 100644 --- a/examples/firmata_blink_api.go +++ b/examples/firmata_blink_api.go @@ -10,9 +10,8 @@ import ( ) func main() { - gbot := gobot.NewMaster() - - a := api.NewAPI(gbot) + master := gobot.NewMaster() + a := api.NewAPI(master) a.Start() firmataAdaptor := firmata.NewAdaptor("/dev/ttyACM0") @@ -30,7 +29,7 @@ func main() { work, ) - gbot.AddRobot(robot) + master.AddRobot(robot) - gbot.Start() + master.Start() } diff --git a/examples/firmata_blinkm.go b/examples/firmata_blinkm.go index 8e0590e33..92e68e56b 100644 --- a/examples/firmata_blinkm.go +++ b/examples/firmata_blinkm.go @@ -10,8 +10,6 @@ import ( ) func main() { - gbot := gobot.NewMaster() - firmataAdaptor := firmata.NewAdaptor("/dev/ttyACM0") blinkm := i2c.NewBlinkMDriver(firmataAdaptor) @@ -32,6 +30,5 @@ func main() { work, ) - gbot.AddRobot(robot) - gbot.Start() + robot.Start() } diff --git a/examples/firmata_button.go b/examples/firmata_button.go index 88cd2fb11..6a0bfa923 100644 --- a/examples/firmata_button.go +++ b/examples/firmata_button.go @@ -7,8 +7,6 @@ import ( ) func main() { - gbot := gobot.NewMaster() - firmataAdaptor := firmata.NewAdaptor("/dev/ttyACM0") button := gpio.NewButtonDriver(firmataAdaptor, "5") @@ -29,7 +27,5 @@ func main() { work, ) - gbot.AddRobot(robot) - - gbot.Start() + robot.Start() } diff --git a/examples/firmata_buzzer.go b/examples/firmata_buzzer.go index 3c333e2d5..0fa1e64d4 100644 --- a/examples/firmata_buzzer.go +++ b/examples/firmata_buzzer.go @@ -9,8 +9,6 @@ import ( ) func main() { - gbot := gobot.NewMaster() - firmataAdaptor := firmata.NewAdaptor("/dev/ttyACM0") buzzer := gpio.NewBuzzerDriver(firmataAdaptor, "3") @@ -49,7 +47,5 @@ func main() { work, ) - gbot.AddRobot(robot) - - gbot.Start() + robot.Start() } diff --git a/examples/firmata_cat_toy.go b/examples/firmata_cat_toy.go index 139bb2c7b..a6a123973 100644 --- a/examples/firmata_cat_toy.go +++ b/examples/firmata_cat_toy.go @@ -11,8 +11,6 @@ import ( ) func main() { - gbot := gobot.NewMaster() - firmataAdaptor := firmata.NewAdaptor("/dev/ttyACM0") servo1 := gpio.NewServoDriver(firmataAdaptor, "5") servo2 := gpio.NewServoDriver(firmataAdaptor, "3") @@ -43,7 +41,5 @@ func main() { work, ) - gbot.AddRobot(robot) - - gbot.Start() + robot.Start() } diff --git a/examples/firmata_direct_pin.go b/examples/firmata_direct_pin.go index 7c8f50ebf..98a2babff 100644 --- a/examples/firmata_direct_pin.go +++ b/examples/firmata_direct_pin.go @@ -9,8 +9,6 @@ import ( ) func main() { - gbot := gobot.NewMaster() - firmataAdaptor := firmata.NewAdaptor("/dev/ttyACM0") pin := gpio.NewDirectPinDriver(firmataAdaptor, "13") @@ -33,7 +31,5 @@ func main() { work, ) - gbot.AddRobot(robot) - - gbot.Start() + robot.Start() } diff --git a/examples/firmata_hmc6352.go b/examples/firmata_hmc6352.go index fdf43ef4d..9f0c545bf 100644 --- a/examples/firmata_hmc6352.go +++ b/examples/firmata_hmc6352.go @@ -10,8 +10,6 @@ import ( ) func main() { - gbot := gobot.NewMaster() - firmataAdaptor := firmata.NewAdaptor("/dev/ttyACM0") hmc6352 := i2c.NewHMC6352Driver(firmataAdaptor) @@ -28,7 +26,5 @@ func main() { work, ) - gbot.AddRobot(robot) - - gbot.Start() + robot.Start() } diff --git a/examples/firmata_integration.go b/examples/firmata_integration.go index 88be7e0f1..f6a567753 100644 --- a/examples/firmata_integration.go +++ b/examples/firmata_integration.go @@ -10,8 +10,6 @@ import ( ) func main() { - gbot := gobot.NewMaster() - firmataAdaptor := firmata.NewAdaptor("/dev/ttyACM0") led1 := gpio.NewLedDriver(firmataAdaptor, "3") led2 := gpio.NewLedDriver(firmataAdaptor, "4") @@ -42,7 +40,5 @@ func main() { work, ) - gbot.AddRobot(robot) - - gbot.Start() + robot.Start() } diff --git a/examples/firmata_led_brightness.go b/examples/firmata_led_brightness.go index 493f4b314..9eb38be85 100644 --- a/examples/firmata_led_brightness.go +++ b/examples/firmata_led_brightness.go @@ -9,8 +9,6 @@ import ( ) func main() { - gbot := gobot.NewMaster() - firmataAdaptor := firmata.NewAdaptor("/dev/ttyACM0") led := gpio.NewLedDriver(firmataAdaptor, "3") @@ -33,7 +31,5 @@ func main() { work, ) - gbot.AddRobot(robot) - - gbot.Start() + robot.Start() } diff --git a/examples/firmata_led_brightness_with_analog_input.go b/examples/firmata_led_brightness_with_analog_input.go index 5eaadb1a1..03198dc9d 100644 --- a/examples/firmata_led_brightness_with_analog_input.go +++ b/examples/firmata_led_brightness_with_analog_input.go @@ -9,8 +9,6 @@ import ( ) func main() { - gbot := gobot.NewMaster() - firmataAdaptor := firmata.NewAdaptor("/dev/ttyACM0") sensor := gpio.NewAnalogSensorDriver(firmataAdaptor, "0") led := gpio.NewLedDriver(firmataAdaptor, "3") @@ -32,7 +30,5 @@ func main() { work, ) - gbot.AddRobot(robot) - - gbot.Start() + robot.Start() } diff --git a/examples/firmata_lidarlite.go b/examples/firmata_lidarlite.go index d3830cc29..f82b7b198 100644 --- a/examples/firmata_lidarlite.go +++ b/examples/firmata_lidarlite.go @@ -10,8 +10,6 @@ import ( ) func main() { - gbot := gobot.NewMaster() - firmataAdaptor := firmata.NewAdaptor("/dev/ttyACM0") lidar := i2c.NewLIDARLiteDriver(firmataAdaptor) @@ -28,7 +26,5 @@ func main() { work, ) - gbot.AddRobot(robot) - - gbot.Start() + robot.Start() } diff --git a/examples/firmata_makey_button.go b/examples/firmata_makey_button.go index 4c8a6f7a3..5d5c96a22 100644 --- a/examples/firmata_makey_button.go +++ b/examples/firmata_makey_button.go @@ -7,8 +7,6 @@ import ( ) func main() { - gbot := gobot.NewMaster() - firmataAdaptor := firmata.NewAdaptor("/dev/ttyACM0") button := gpio.NewMakeyButtonDriver(firmataAdaptor, "2") led := gpio.NewLedDriver(firmataAdaptor, "13") @@ -29,7 +27,5 @@ func main() { work, ) - gbot.AddRobot(robot) - - gbot.Start() + robot.Start() } diff --git a/examples/firmata_mma7660.go b/examples/firmata_mma7660.go index 8c1f251e3..cd7f24022 100644 --- a/examples/firmata_mma7660.go +++ b/examples/firmata_mma7660.go @@ -10,8 +10,6 @@ import ( ) func main() { - gbot := gobot.NewMaster() - firmataAdaptor := firmata.NewAdaptor("/dev/ttyACM0") mma7660 := i2c.NewMMA7660Driver(firmataAdaptor) @@ -32,7 +30,5 @@ func main() { work, ) - gbot.AddRobot(robot) - - gbot.Start() + robot.Start() } diff --git a/examples/firmata_motor.go b/examples/firmata_motor.go index ea799b7fe..d5cd8ba7d 100644 --- a/examples/firmata_motor.go +++ b/examples/firmata_motor.go @@ -9,8 +9,6 @@ import ( ) func main() { - gbot := gobot.NewMaster() - firmataAdaptor := firmata.NewAdaptor("/dev/ttyACM0") motor := gpio.NewMotorDriver(firmataAdaptor, "3") @@ -33,7 +31,5 @@ func main() { work, ) - gbot.AddRobot(robot) - - gbot.Start() + robot.Start() } diff --git a/examples/firmata_mpl115a2.go b/examples/firmata_mpl115a2.go index 755170e7e..c2de15660 100644 --- a/examples/firmata_mpl115a2.go +++ b/examples/firmata_mpl115a2.go @@ -10,8 +10,6 @@ import ( ) func main() { - gbot := gobot.NewMaster() - firmataAdaptor := firmata.NewAdaptor("/dev/ttyACM0") mpl115a2 := i2c.NewMPL115A2Driver(firmataAdaptor) @@ -28,7 +26,5 @@ func main() { work, ) - gbot.AddRobot(robot) - - gbot.Start() + robot.Start() } diff --git a/examples/firmata_mpu6050.go b/examples/firmata_mpu6050.go index 8b82eea0b..f79cfc081 100644 --- a/examples/firmata_mpu6050.go +++ b/examples/firmata_mpu6050.go @@ -10,8 +10,6 @@ import ( ) func main() { - gbot := gobot.NewMaster() - firmataAdaptor := firmata.NewAdaptor("/dev/ttyACM0") mpu6050 := i2c.NewMPU6050Driver(firmataAdaptor) @@ -29,7 +27,5 @@ func main() { work, ) - gbot.AddRobot(robot) - - gbot.Start() + robot.Start() } diff --git a/examples/firmata_rgb_led.go b/examples/firmata_rgb_led.go index 7ea932990..5c1730645 100644 --- a/examples/firmata_rgb_led.go +++ b/examples/firmata_rgb_led.go @@ -9,8 +9,6 @@ import ( ) func main() { - gbot := gobot.NewMaster() - board := firmata.NewAdaptor("/dev/ttyACM0") led := gpio.NewRgbLedDriver(board, "3", "5", "6") @@ -29,7 +27,5 @@ func main() { work, ) - gbot.AddRobot(robot) - - gbot.Start() + robot.Start() } diff --git a/examples/firmata_servo.go b/examples/firmata_servo.go index f2ae97503..f8a280c10 100644 --- a/examples/firmata_servo.go +++ b/examples/firmata_servo.go @@ -10,8 +10,6 @@ import ( ) func main() { - gbot := gobot.NewMaster() - firmataAdaptor := firmata.NewAdaptor("/dev/ttyACM0") servo := gpio.NewServoDriver(firmataAdaptor, "3") @@ -29,6 +27,5 @@ func main() { work, ) - gbot.AddRobot(robot) - gbot.Start() + robot.Start() } diff --git a/examples/firmata_temp36.go b/examples/firmata_temp36.go index e9b2f34f1..0529131c8 100644 --- a/examples/firmata_temp36.go +++ b/examples/firmata_temp36.go @@ -10,8 +10,6 @@ import ( ) func main() { - gbot := gobot.NewMaster() - firmataAdaptor := firmata.NewAdaptor("/dev/ttyACM0") work := func() { @@ -37,7 +35,5 @@ func main() { work, ) - gbot.AddRobot(robot) - - gbot.Start() + robot.Start() } diff --git a/examples/firmata_travis.go b/examples/firmata_travis.go index ea5d5423e..bbbecd63f 100644 --- a/examples/firmata_travis.go +++ b/examples/firmata_travis.go @@ -64,8 +64,7 @@ func checkTravis(robot *gobot.Robot) { } func main() { - gbot := gobot.NewMaster() - + master := gobot.NewMaster() firmataAdaptor := firmata.NewAdaptor("/dev/ttyACM0") red := gpio.NewLedDriver(firmataAdaptor, "7") red.SetName("red") @@ -75,9 +74,9 @@ func main() { blue.SetName("blue") work := func() { - checkTravis(gbot.Robot("travis")) + checkTravis(master.Robot("travis")) gobot.Every(10*time.Second, func() { - checkTravis(gbot.Robot("travis")) + checkTravis(master.Robot("travis")) }) } @@ -87,7 +86,6 @@ func main() { work, ) - gbot.AddRobot(robot) - - gbot.Start() + master.AddRobot(robot) + master.Start() } diff --git a/examples/firmata_wiichuck.go b/examples/firmata_wiichuck.go index 508ded7a6..153abc297 100644 --- a/examples/firmata_wiichuck.go +++ b/examples/firmata_wiichuck.go @@ -9,8 +9,6 @@ import ( ) func main() { - gbot := gobot.NewMaster() - firmataAdaptor := firmata.NewAdaptor("/dev/ttyACM0") wiichuck := i2c.NewWiichuckDriver(firmataAdaptor) @@ -38,7 +36,5 @@ func main() { work, ) - gbot.AddRobot(robot) - - gbot.Start() + robot.Start() } diff --git a/examples/hello.go b/examples/hello.go index 08dc67a22..77376cbf5 100644 --- a/examples/hello.go +++ b/examples/hello.go @@ -8,16 +8,11 @@ import ( ) func main() { - gbot := gobot.NewMaster() - robot := gobot.NewRobot( - "hello", func() { gobot.Every(500*time.Millisecond, func() { fmt.Println("Greetings human") }) }, ) - gbot.AddRobot(robot) - - gbot.Start() + robot.Start() } diff --git a/examples/hello_api.go b/examples/hello_api.go index 8f5e23a33..3a78929b0 100644 --- a/examples/hello_api.go +++ b/examples/hello_api.go @@ -10,25 +10,25 @@ import ( ) func main() { - gbot := gobot.NewMaster() + master := gobot.NewMaster() - a := api.NewAPI(gbot) + a := api.NewAPI(master) a.AddHandler(func(w http.ResponseWriter, r *http.Request) { fmt.Fprintf(w, "Hello, %q \n", html.EscapeString(r.URL.Path)) }) a.Debug() a.Start() - gbot.AddCommand("custom_gobot_command", + master.AddCommand("custom_gobot_command", func(params map[string]interface{}) interface{} { return "This command is attached to the mcp!" }) - hello := gbot.AddRobot(gobot.NewRobot("hello")) + hello := master.AddRobot(gobot.NewRobot("hello")) hello.AddCommand("hi_there", func(params map[string]interface{}) interface{} { return fmt.Sprintf("This command is attached to the robot %v", hello.Name) }) - gbot.Start() + master.Start() } diff --git a/examples/hello_api_auth.go b/examples/hello_api_auth.go index 4f73b4378..8a82f66cd 100644 --- a/examples/hello_api_auth.go +++ b/examples/hello_api_auth.go @@ -10,9 +10,9 @@ import ( ) func main() { - gbot := gobot.NewMaster() + master := gobot.NewMaster() - a := api.NewAPI(gbot) + a := api.NewAPI(master) a.AddHandler(api.BasicAuth("gort", "klatuu")) a.Debug() @@ -21,16 +21,16 @@ func main() { }) a.Start() - gbot.AddCommand("custom_gobot_command", + master.AddCommand("custom_gobot_command", func(params map[string]interface{}) interface{} { return "This command is attached to the mcp!" }) - hello := gbot.AddRobot(gobot.NewRobot("hello")) + hello := master.AddRobot(gobot.NewRobot("hello")) hello.AddCommand("hi_there", func(params map[string]interface{}) interface{} { return fmt.Sprintf("This command is attached to the robot %v", hello.Name) }) - gbot.Start() + master.Start() } diff --git a/examples/joule_blink.go b/examples/joule_blink.go index 99f304784..e3a23d5b9 100644 --- a/examples/joule_blink.go +++ b/examples/joule_blink.go @@ -9,8 +9,6 @@ import ( ) func main() { - gbot := gobot.NewMaster() - e := joule.NewAdaptor() led := gpio.NewLedDriver(e, "100") @@ -26,7 +24,5 @@ func main() { work, ) - gbot.AddRobot(robot) - - gbot.Start() + robot.Start() } diff --git a/examples/joule_blinkm.go b/examples/joule_blinkm.go index d14c6ccb4..4e3efdf8d 100644 --- a/examples/joule_blinkm.go +++ b/examples/joule_blinkm.go @@ -10,8 +10,6 @@ import ( ) func main() { - gbot := gobot.NewMaster() - e := joule.NewAdaptor() blinkm := i2c.NewBlinkMDriver(e) @@ -32,6 +30,5 @@ func main() { work, ) - gbot.AddRobot(robot) - gbot.Start() + robot.Start() } diff --git a/examples/joule_grove_lcd.go b/examples/joule_grove_lcd.go index 3c83e9fb6..8b8484b2a 100644 --- a/examples/joule_grove_lcd.go +++ b/examples/joule_grove_lcd.go @@ -9,8 +9,6 @@ import ( ) func main() { - gbot := gobot.NewMaster() - board := joule.NewAdaptor() screen := i2c.NewGroveLcdDriver(board) @@ -43,7 +41,5 @@ func main() { work, ) - gbot.AddRobot(robot) - - gbot.Start() + robot.Start() } diff --git a/examples/joule_leds.go b/examples/joule_leds.go index 9827b7c0c..1c23d6e59 100644 --- a/examples/joule_leds.go +++ b/examples/joule_leds.go @@ -9,8 +9,6 @@ import ( ) func main() { - gbot := gobot.NewMaster() - e := joule.NewAdaptor() led0 := gpio.NewLedDriver(e, "100") led1 := gpio.NewLedDriver(e, "101") @@ -43,7 +41,5 @@ func main() { work, ) - gbot.AddRobot(robot) - - gbot.Start() + robot.Start() } diff --git a/examples/joule_rgb_led.go b/examples/joule_rgb_led.go index aaedb58b9..064e3d45a 100644 --- a/examples/joule_rgb_led.go +++ b/examples/joule_rgb_led.go @@ -9,8 +9,6 @@ import ( ) func main() { - gbot := gobot.NewMaster() - e := joule.NewAdaptor() led := gpio.NewRgbLedDriver(e, "25", "27", "29") @@ -29,7 +27,5 @@ func main() { work, ) - gbot.AddRobot(robot) - - gbot.Start() + robot.Start() } diff --git a/examples/joystick_ps3.go b/examples/joystick_ps3.go index cb7380439..1e07d0cb4 100644 --- a/examples/joystick_ps3.go +++ b/examples/joystick_ps3.go @@ -8,8 +8,6 @@ import ( ) func main() { - gbot := gobot.NewMaster() - joystickAdaptor := joystick.NewAdaptor() stick := joystick.NewDriver(joystickAdaptor, "./platforms/joystick/configs/dualshock3.json", @@ -48,7 +46,5 @@ func main() { work, ) - gbot.AddRobot(robot) - - gbot.Start() + robot.Start() } diff --git a/examples/joystick_ps4.go b/examples/joystick_ps4.go index 269ea4e3c..bd709181c 100644 --- a/examples/joystick_ps4.go +++ b/examples/joystick_ps4.go @@ -8,8 +8,6 @@ import ( ) func main() { - gbot := gobot.NewMaster() - joystickAdaptor := joystick.NewAdaptor() stick := joystick.NewDriver(joystickAdaptor, "./platforms/joystick/configs/dualshock4.json", @@ -60,7 +58,5 @@ func main() { work, ) - gbot.AddRobot(robot) - - gbot.Start() + robot.Start() } diff --git a/examples/joystick_xbox360.go b/examples/joystick_xbox360.go index 751ca5e2c..3216293cc 100644 --- a/examples/joystick_xbox360.go +++ b/examples/joystick_xbox360.go @@ -8,8 +8,6 @@ import ( ) func main() { - gbot := gobot.NewMaster() - joystickAdaptor := joystick.NewAdaptor() stick := joystick.NewDriver(joystickAdaptor, "./platforms/joystick/configs/joystick/configs/xbox360_power_a_mini_proex.json", @@ -60,7 +58,5 @@ func main() { work, ) - gbot.AddRobot(robot) - - gbot.Start() + robot.Start() } diff --git a/examples/keyboard.go b/examples/keyboard.go index dadca864d..74dce3f47 100644 --- a/examples/keyboard.go +++ b/examples/keyboard.go @@ -8,8 +8,6 @@ import ( ) func main() { - gbot := gobot.NewMaster() - keys := keyboard.NewDriver() work := func() { @@ -30,7 +28,5 @@ func main() { work, ) - gbot.AddRobot(robot) - - gbot.Start() + robot.Start() } diff --git a/examples/leap_motion.go b/examples/leap_motion.go index 2970cf9db..532fcc2d0 100644 --- a/examples/leap_motion.go +++ b/examples/leap_motion.go @@ -8,8 +8,6 @@ import ( ) func main() { - gbot := gobot.NewMaster() - leapMotionAdaptor := leap.NewAdaptor("127.0.0.1:6437") l := leap.NewDriver(leapMotionAdaptor) @@ -25,7 +23,5 @@ func main() { work, ) - gbot.AddRobot(robot) - - gbot.Start() + robot.Start() } diff --git a/examples/leap_motion_gestures.go b/examples/leap_motion_gestures.go index 392a579d9..a8ca26722 100644 --- a/examples/leap_motion_gestures.go +++ b/examples/leap_motion_gestures.go @@ -8,8 +8,6 @@ import ( ) func main() { - gbot := gobot.NewMaster() - leapMotionAdaptor := leap.NewAdaptor("127.0.0.1:6437") l := leap.NewDriver(leapMotionAdaptor) @@ -25,9 +23,7 @@ func main() { work, ) - gbot.AddRobot(robot) - - gbot.Start() + robot.Start() } func printGesture(gesture leap.Gesture) { diff --git a/examples/leap_motion_hands.go b/examples/leap_motion_hands.go index f801fcd36..2954217c5 100644 --- a/examples/leap_motion_hands.go +++ b/examples/leap_motion_hands.go @@ -8,8 +8,6 @@ import ( ) func main() { - gbot := gobot.NewMaster() - leapMotionAdaptor := leap.NewAdaptor("127.0.0.1:6437") l := leap.NewDriver(leapMotionAdaptor) @@ -25,9 +23,7 @@ func main() { work, ) - gbot.AddRobot(robot) - - gbot.Start() + robot.Start() } func printHand(hand leap.Hand) { diff --git a/examples/leap_servos.go b/examples/leap_servos.go index 6f075b01e..7fc2d51af 100644 --- a/examples/leap_servos.go +++ b/examples/leap_servos.go @@ -9,8 +9,6 @@ import ( // Video: https://www.youtube.com/watch?v=ayNMyUfdAqc func main() { - gbot := gobot.NewMaster() - firmataAdaptor := firmata.NewAdaptor("/dev/tty.usbmodem1451") servo1 := gpio.NewServoDriver(firmataAdaptor, "3") servo2 := gpio.NewServoDriver(firmataAdaptor, "4") @@ -49,6 +47,5 @@ func main() { work, ) - gbot.AddRobot(robot) - gbot.Start() + robot.Start() } diff --git a/examples/leap_sphero.go b/examples/leap_sphero.go index aabb20d2c..8baa6fe47 100644 --- a/examples/leap_sphero.go +++ b/examples/leap_sphero.go @@ -9,8 +9,6 @@ import ( ) func main() { - gbot := gobot.NewMaster() - leapAdaptor := leap.NewAdaptor("127.0.0.1:6437") spheroAdaptor := sphero.NewAdaptor("/dev/tty.Sphero-YBW-RN-SPP") @@ -36,9 +34,7 @@ func main() { work, ) - gbot.AddRobot(robot) - - gbot.Start() + robot.Start() } func scale(position float64) uint8 { diff --git a/examples/mavlink.go b/examples/mavlink.go index 31fd5c807..3fdfd8383 100644 --- a/examples/mavlink.go +++ b/examples/mavlink.go @@ -9,8 +9,6 @@ import ( ) func main() { - gbot := gobot.NewMaster() - adaptor := mavlink.NewAdaptor("/dev/ttyACM0") iris := mavlink.NewDriver(adaptor) @@ -52,7 +50,5 @@ func main() { work, ) - gbot.AddRobot(robot) - - gbot.Start() + robot.Start() } diff --git a/examples/megapi_motor.go b/examples/megapi_motor.go index 7fb20bde9..be1bee71a 100644 --- a/examples/megapi_motor.go +++ b/examples/megapi_motor.go @@ -8,8 +8,6 @@ import ( ) func main() { - gbot := gobot.NewMaster() - // use "/dev/ttyUSB0" if connecting with USB cable // use "/dev/ttyAMA0" on devices older than Raspberry Pi 3 Model B megaPiAdaptor := megapi.NewAdaptor("/dev/ttyS0") @@ -34,7 +32,5 @@ func main() { work, ) - gbot.AddRobot(robot) - - gbot.Start() + robot.Start() } diff --git a/examples/minidrone.go b/examples/minidrone.go index e432fbc75..808527661 100644 --- a/examples/minidrone.go +++ b/examples/minidrone.go @@ -10,8 +10,6 @@ import ( ) func main() { - gbot := gobot.NewMaster() - bleAdaptor := ble.NewClientAdaptor(os.Args[1]) drone := ble.NewMinidroneDriver(bleAdaptor) @@ -47,7 +45,5 @@ func main() { work, ) - gbot.AddRobot(robot) - - gbot.Start() + robot.Start() } diff --git a/examples/minidrone_ps3.go b/examples/minidrone_ps3.go index 9f0e66a35..ac2ff42c8 100644 --- a/examples/minidrone_ps3.go +++ b/examples/minidrone_ps3.go @@ -16,8 +16,6 @@ type pair struct { } func main() { - gbot := gobot.NewMaster() - joystickAdaptor := joystick.NewAdaptor() stick := joystick.NewDriver(joystickAdaptor, "./platforms/joystick/configs/dualshock3.json", @@ -122,9 +120,7 @@ func main() { work, ) - gbot.AddRobot(robot) - - gbot.Start() + robot.Start() } func validatePitch(data float64, offset float64) int { diff --git a/examples/mqtt_firmata_blink.go b/examples/mqtt_firmata_blink.go index ed6240265..6463fdfb5 100644 --- a/examples/mqtt_firmata_blink.go +++ b/examples/mqtt_firmata_blink.go @@ -10,8 +10,6 @@ import ( ) func main() { - gbot := gobot.NewMaster() - mqttAdaptor := mqtt.NewAdaptor("tcp://test.mosquitto.org:1883", "blinker") firmataAdaptor := firmata.NewAdaptor("/dev/ttyACM0") led := gpio.NewLedDriver(firmataAdaptor, "13") @@ -38,7 +36,5 @@ func main() { work, ) - gbot.AddRobot(robot) - - gbot.Start() + robot.Start() } diff --git a/examples/mqtt_ping.go b/examples/mqtt_ping.go index c1d54241f..5bb6fc8d7 100644 --- a/examples/mqtt_ping.go +++ b/examples/mqtt_ping.go @@ -9,8 +9,6 @@ import ( ) func main() { - gbot := gobot.NewMaster() - mqttAdaptor := mqtt.NewAdaptor("tcp://test.mosquitto.org:1883", "pinger") work := func() { @@ -34,7 +32,5 @@ func main() { work, ) - gbot.AddRobot(robot) - - gbot.Start() + robot.Start() } diff --git a/examples/nats.go b/examples/nats.go index a8d081a29..cd6813056 100644 --- a/examples/nats.go +++ b/examples/nats.go @@ -9,8 +9,6 @@ import ( ) func main() { - gbot := gobot.NewMaster() - natsAdaptor := nats.NewAdaptorWithAuth("localhost:4222", 1234, "user", "pass") work := func() { @@ -34,7 +32,5 @@ func main() { work, ) - gbot.AddRobot(robot) - - gbot.Start() + robot.Start() } diff --git a/examples/neurosky.go b/examples/neurosky.go index c454b2683..8ccfa8d98 100644 --- a/examples/neurosky.go +++ b/examples/neurosky.go @@ -8,8 +8,6 @@ import ( ) func main() { - gbot := gobot.NewMaster() - adaptor := neurosky.NewAdaptor("/dev/rfcomm0") neuro := neurosky.NewDriver(adaptor) @@ -52,6 +50,5 @@ func main() { work, ) - gbot.AddRobot(robot) - gbot.Start() + robot.Start() } diff --git a/examples/ollie.go b/examples/ollie.go index 2f37319b5..5b30cf0ff 100644 --- a/examples/ollie.go +++ b/examples/ollie.go @@ -9,8 +9,6 @@ import ( ) func main() { - gbot := gobot.NewMaster() - bleAdaptor := ble.NewClientAdaptor(os.Args[1]) ollie := ble.NewSpheroOllieDriver(bleAdaptor) @@ -29,7 +27,5 @@ func main() { work, ) - gbot.AddRobot(robot) - - gbot.Start() + robot.Start() } diff --git a/examples/ollie_roll.go b/examples/ollie_roll.go index b1741a897..5afc0f16a 100644 --- a/examples/ollie_roll.go +++ b/examples/ollie_roll.go @@ -9,8 +9,6 @@ import ( ) func main() { - gbot := gobot.NewMaster() - bleAdaptor := ble.NewClientAdaptor(os.Args[1]) ollie := ble.NewSpheroOllieDriver(bleAdaptor) @@ -27,7 +25,5 @@ func main() { work, ) - gbot.AddRobot(robot) - - gbot.Start() + robot.Start() } diff --git a/examples/opencv_face_detect.go b/examples/opencv_face_detect.go index 8aa8834d5..7c4db0c22 100644 --- a/examples/opencv_face_detect.go +++ b/examples/opencv_face_detect.go @@ -14,8 +14,6 @@ func main() { _, currentfile, _, _ := runtime.Caller(0) cascade := path.Join(path.Dir(currentfile), "haarcascade_frontalface_alt.xml") - gbot := gobot.NewMaster() - window := opencv.NewWindowDriver() camera := opencv.NewCameraDriver(0) @@ -43,7 +41,5 @@ func main() { work, ) - gbot.AddRobot(robot) - - gbot.Start() + robot.Start() } diff --git a/examples/opencv_window.go b/examples/opencv_window.go index daf05e54e..28b876f8a 100644 --- a/examples/opencv_window.go +++ b/examples/opencv_window.go @@ -7,8 +7,6 @@ import ( ) func main() { - gbot := gobot.NewMaster() - window := opencv.NewWindowDriver() camera := opencv.NewCameraDriver(0) @@ -23,7 +21,5 @@ func main() { work, ) - gbot.AddRobot(robot) - - gbot.Start() + robot.Start() } diff --git a/examples/particle_api.go b/examples/particle_api.go index 16d98038f..d40141458 100644 --- a/examples/particle_api.go +++ b/examples/particle_api.go @@ -10,8 +10,8 @@ import ( ) func main() { - gbot := gobot.NewMaster() - api.NewAPI(gbot).Start() + master := gobot.NewMaster() + api.NewAPI(master).Start() core := particle.NewAdaptor("device_id", "access_token") led := gpio.NewLedDriver(core, "D7") @@ -28,7 +28,7 @@ func main() { work, ) - gbot.AddRobot(robot) + master.AddRobot(robot) - gbot.Start() + master.Start() } diff --git a/examples/particle_blink.go b/examples/particle_blink.go index 5761abec5..ec19212f3 100644 --- a/examples/particle_blink.go +++ b/examples/particle_blink.go @@ -9,8 +9,6 @@ import ( ) func main() { - gbot := gobot.NewMaster() - core := particle.NewAdaptor("device_id", "access_token") led := gpio.NewLedDriver(core, "D7") @@ -26,7 +24,5 @@ func main() { work, ) - gbot.AddRobot(robot) - - gbot.Start() + robot.Start() } diff --git a/examples/particle_button.go b/examples/particle_button.go index b2f6b9cf8..0e712c312 100644 --- a/examples/particle_button.go +++ b/examples/particle_button.go @@ -7,8 +7,6 @@ import ( ) func main() { - gbot := gobot.NewMaster() - core := particle.NewAdaptor("device_id", "access_token") led := gpio.NewLedDriver(core, "D7") button := gpio.NewButtonDriver(core, "D5") @@ -29,7 +27,5 @@ func main() { work, ) - gbot.AddRobot(robot) - - gbot.Start() + robot.Start() } diff --git a/examples/particle_events.go b/examples/particle_events.go index bdab61fa3..574f3d5d7 100644 --- a/examples/particle_events.go +++ b/examples/particle_events.go @@ -8,8 +8,6 @@ import ( ) func main() { - gbot := gobot.NewMaster() - core := particle.NewAdaptor("DEVICE_ID", "ACCESS_TOKEN") work := func() { @@ -26,7 +24,5 @@ func main() { work, ) - gbot.AddRobot(robot) - - gbot.Start() + robot.Start() } diff --git a/examples/particle_function.go b/examples/particle_function.go index 0114d77a0..714d0e8c4 100644 --- a/examples/particle_function.go +++ b/examples/particle_function.go @@ -8,8 +8,6 @@ import ( ) func main() { - gbot := gobot.NewMaster() - core := particle.NewAdaptor("DEVICE_ID", "ACCESS_TOKEN") work := func() { @@ -25,7 +23,5 @@ func main() { work, ) - gbot.AddRobot(robot) - - gbot.Start() + robot.Start() } diff --git a/examples/particle_led_brightness.go b/examples/particle_led_brightness.go index b429fa828..0b4616f51 100644 --- a/examples/particle_led_brightness.go +++ b/examples/particle_led_brightness.go @@ -9,8 +9,6 @@ import ( ) func main() { - gbot := gobot.NewMaster() - core := particle.NewAdaptor("device_id", "access_token") led := gpio.NewLedDriver(core, "A1") @@ -33,7 +31,5 @@ func main() { work, ) - gbot.AddRobot(robot) - - gbot.Start() + robot.Start() } diff --git a/examples/particle_variable.go b/examples/particle_variable.go index 9de1040b8..157b07951 100644 --- a/examples/particle_variable.go +++ b/examples/particle_variable.go @@ -9,8 +9,6 @@ import ( ) func main() { - gbot := gobot.NewMaster() - core := particle.NewAdaptor("DEVICE_ID", "ACCESS_TOKEN") work := func() { @@ -28,7 +26,5 @@ func main() { work, ) - gbot.AddRobot(robot) - - gbot.Start() + robot.Start() } diff --git a/examples/pebble.go b/examples/pebble.go index 63df4e5d7..3c08c7d96 100644 --- a/examples/pebble.go +++ b/examples/pebble.go @@ -9,8 +9,8 @@ import ( ) func main() { - gbot := gobot.NewMaster() - api := api.NewAPI(gbot) + master := gobot.NewMaster() + api := api.NewAPI(master) api.Port = "8080" api.Start() @@ -34,7 +34,7 @@ func main() { work, ) - gbot.AddRobot(robot) + master.AddRobot(robot) - gbot.Start() + master.Start() } diff --git a/examples/pebble_accelerometer.go b/examples/pebble_accelerometer.go index f114350b0..fad7928d2 100644 --- a/examples/pebble_accelerometer.go +++ b/examples/pebble_accelerometer.go @@ -9,8 +9,8 @@ import ( ) func main() { - gbot := gobot.NewMaster() - a := api.NewAPI(gbot) + master := gobot.NewMaster() + a := api.NewAPI(master) a.Port = "8080" a.Start() @@ -29,7 +29,7 @@ func main() { work, ) - gbot.AddRobot(robot) + master.AddRobot(robot) - gbot.Start() + master.Start() } diff --git a/examples/raspi_adafruit_dcmotor.go b/examples/raspi_adafruit_dcmotor.go index 38cc9fffe..cb065af69 100644 --- a/examples/raspi_adafruit_dcmotor.go +++ b/examples/raspi_adafruit_dcmotor.go @@ -36,8 +36,8 @@ func adafruitDCMotorRunner(a *i2c.AdafruitMotorHatDriver, dcMotor int) (err erro } return } + func main() { - gbot := gobot.NewMaster() r := raspi.NewAdaptor() adaFruit := i2c.NewAdafruitMotorHatDriver(r) @@ -55,7 +55,5 @@ func main() { work, ) - gbot.AddRobot(robot) - - gbot.Start() + robot.Start() } diff --git a/examples/raspi_adafruit_servo.go b/examples/raspi_adafruit_servo.go index 57e0f4d24..db47d2d84 100644 --- a/examples/raspi_adafruit_servo.go +++ b/examples/raspi_adafruit_servo.go @@ -67,7 +67,6 @@ func adafruitServoMotorRunner(a *i2c.AdafruitMotorHatDriver) (err error) { } func main() { - gbot := gobot.NewMaster() r := raspi.NewAdaptor() adaFruit := i2c.NewAdafruitMotorHatDriver(r) @@ -83,7 +82,5 @@ func main() { work, ) - gbot.AddRobot(robot) - - gbot.Start() + robot.Start() } diff --git a/examples/raspi_adafruit_stepper.go b/examples/raspi_adafruit_stepper.go index bbc21f63e..0d75685e8 100644 --- a/examples/raspi_adafruit_stepper.go +++ b/examples/raspi_adafruit_stepper.go @@ -30,7 +30,6 @@ func adafruitStepperMotorRunner(a *i2c.AdafruitMotorHatDriver, motor int) (err e } func main() { - gbot := gobot.NewMaster() r := raspi.NewAdaptor() adaFruit := i2c.NewAdafruitMotorHatDriver(r) @@ -47,7 +46,5 @@ func main() { work, ) - gbot.AddRobot(robot) - - gbot.Start() + robot.Start() } diff --git a/examples/raspi_blink.go b/examples/raspi_blink.go index 7b549b2b4..a59b20a06 100644 --- a/examples/raspi_blink.go +++ b/examples/raspi_blink.go @@ -9,8 +9,6 @@ import ( ) func main() { - gbot := gobot.NewMaster() - r := raspi.NewAdaptor() led := gpio.NewLedDriver(r, "7") @@ -26,7 +24,5 @@ func main() { work, ) - gbot.AddRobot(robot) - - gbot.Start() + robot.Start() } diff --git a/examples/raspi_blinkm.go b/examples/raspi_blinkm.go index 4b5def379..907ff20ec 100644 --- a/examples/raspi_blinkm.go +++ b/examples/raspi_blinkm.go @@ -10,7 +10,6 @@ import ( ) func main() { - gbot := gobot.NewMaster() r := raspi.NewAdaptor() blinkm := i2c.NewBlinkMDriver(r) @@ -31,7 +30,5 @@ func main() { work, ) - gbot.AddRobot(robot) - - gbot.Start() + robot.Start() } diff --git a/examples/raspi_button.go b/examples/raspi_button.go index 430d9de8f..4db4ebf17 100644 --- a/examples/raspi_button.go +++ b/examples/raspi_button.go @@ -9,8 +9,6 @@ import ( ) func main() { - gbot := gobot.NewMaster() - r := raspi.NewAdaptor() button := gpio.NewButtonDriver(r, "11") led := gpio.NewLedDriver(r, "7") @@ -32,6 +30,6 @@ func main() { []gobot.Device{button, led}, work, ) - gbot.AddRobot(robot) - gbot.Start() + + robot.Start() } diff --git a/examples/sphero.go b/examples/sphero.go index d2e54a7cd..d4fb43509 100644 --- a/examples/sphero.go +++ b/examples/sphero.go @@ -9,8 +9,6 @@ import ( ) func main() { - gbot := gobot.NewMaster() - adaptor := sphero.NewAdaptor("/dev/rfcomm0") spheroDriver := sphero.NewSpheroDriver(adaptor) @@ -43,7 +41,5 @@ func main() { work, ) - gbot.AddRobot(robot) - - gbot.Start() + robot.Start() } diff --git a/examples/sphero_api.go b/examples/sphero_api.go index bd3ef4004..c6b36f91a 100644 --- a/examples/sphero_api.go +++ b/examples/sphero_api.go @@ -7,8 +7,8 @@ import ( ) func main() { - gbot := gobot.NewMaster() - api.NewAPI(gbot).Start() + master := gobot.NewMaster() + api.NewAPI(master).Start() spheros := map[string]string{ "Sphero-BPO": "/dev/rfcomm0", @@ -32,8 +32,8 @@ func main() { return nil }) - gbot.AddRobot(robot) + master.AddRobot(robot) } - gbot.Start() + master.Start() } diff --git a/examples/sphero_conways.go b/examples/sphero_conways.go index 2cd9299da..c876ba278 100644 --- a/examples/sphero_conways.go +++ b/examples/sphero_conways.go @@ -16,7 +16,7 @@ type conway struct { } func main() { - gbot := gobot.NewMaster() + master := gobot.NewMaster() spheros := []string{ "/dev/rfcomm0", @@ -58,10 +58,11 @@ func main() { []gobot.Device{cell}, work, ) - gbot.AddRobot(robot) + + master.AddRobot(robot) } - gbot.Start() + master.Start() } func (c *conway) resetContacts() { diff --git a/examples/sphero_dpad.go b/examples/sphero_dpad.go index 3f37917f0..be87dd4c4 100644 --- a/examples/sphero_dpad.go +++ b/examples/sphero_dpad.go @@ -9,8 +9,8 @@ import ( ) func main() { - gbot := gobot.NewMaster() - a := api.NewAPI(gbot) + master := gobot.NewMaster() + a := api.NewAPI(master) a.Start() conn := sphero.NewAdaptor("/dev/rfcomm0") @@ -40,7 +40,7 @@ func main() { return "ok" }) - gbot.AddRobot(robot) + master.AddRobot(robot) - gbot.Start() + master.Start() } diff --git a/examples/sphero_master.go b/examples/sphero_master.go index bb71e79d9..6394b91a1 100644 --- a/examples/sphero_master.go +++ b/examples/sphero_master.go @@ -8,7 +8,7 @@ import ( ) func main() { - gbot := gobot.NewMaster() + master := gobot.NewMaster() spheros := map[string]string{ "Sphero-BPO": "/dev/rfcomm0", @@ -28,13 +28,13 @@ func main() { work, ) - gbot.AddRobot(robot) + master.AddRobot(robot) } robot := gobot.NewRobot("", func() { gobot.Every(1*time.Second, func() { - sphero := gbot.Robot("Sphero-BPO").Device("sphero").(*sphero.SpheroDriver) + sphero := master.Robot("Sphero-BPO").Device("sphero").(*sphero.SpheroDriver) sphero.SetRGB(uint8(gobot.Rand(255)), uint8(gobot.Rand(255)), uint8(gobot.Rand(255)), @@ -43,7 +43,7 @@ func main() { }, ) - gbot.AddRobot(robot) + master.AddRobot(robot) - gbot.Start() + master.Start() } diff --git a/examples/square.go b/examples/square.go index 84d4ac507..983fc2254 100644 --- a/examples/square.go +++ b/examples/square.go @@ -10,8 +10,8 @@ import ( ) func main() { - gbot := gobot.NewMaster() - a := api.NewAPI(gbot) + master := gobot.NewMaster() + a := api.NewAPI(master) a.Start() board := edison.NewAdaptor() @@ -72,7 +72,7 @@ func main() { return enabled }) - gbot.AddRobot(robot) + master.AddRobot(robot) - gbot.Start() + master.Start() } diff --git a/examples/square_fire.go b/examples/square_fire.go index 3990a72ef..1ea51c9e3 100644 --- a/examples/square_fire.go +++ b/examples/square_fire.go @@ -10,8 +10,8 @@ import ( ) func main() { - gbot := gobot.NewMaster() - a := api.NewAPI(gbot) + master := gobot.NewMaster() + a := api.NewAPI(master) a.Start() board := edison.NewAdaptor() @@ -72,7 +72,7 @@ func main() { return enabled }) - gbot.AddRobot(robot) + master.AddRobot(robot) - gbot.Start() + master.Start() }