diff --git a/examples/raspi_adafruit_dcmotor.go b/examples/raspi_adafruit_dcmotor.go index 747b4798..6c764d16 100644 --- a/examples/raspi_adafruit_dcmotor.go +++ b/examples/raspi_adafruit_dcmotor.go @@ -10,7 +10,6 @@ import ( ) func adafruitDCMotorRunner(a *i2c.AdafruitMotorHatDriver, dcMotor int) (err error) { - log.Printf("DC Motor Run Loop...\n") // set the speed: var speed int32 = 255 // 255 = full speed! @@ -37,10 +36,11 @@ func adafruitDCMotorRunner(a *i2c.AdafruitMotorHatDriver, dcMotor int) (err erro } return } + func main() { gbot := gobot.NewGobot() - r := raspi.NewRaspiAdaptor("raspi") - adaFruit := i2c.NewAdafruitMotorHatDriver(r, "adafruit") + r := raspi.NewAdaptor() + adaFruit := i2c.NewAdafruitMotorHatDriver(r) work := func() { gobot.Every(5*time.Second, func() { diff --git a/examples/raspi_adafruit_servo.go b/examples/raspi_adafruit_servo.go index 650bcf06..f0b0baee 100644 --- a/examples/raspi_adafruit_servo.go +++ b/examples/raspi_adafruit_servo.go @@ -26,6 +26,7 @@ func degree2pulse(deg int) int32 { pulse += ((servoMax - servoMin) / maxDegree) * deg return int32(pulse) } + func adafruitServoMotorRunner(a *i2c.AdafruitMotorHatDriver) (err error) { log.Printf("Servo Motor Run Loop...\n") // Changing from the default 0x40 address because this configuration involves @@ -64,14 +65,14 @@ func adafruitServoMotorRunner(a *i2c.AdafruitMotorHatDriver) (err error) { } return } + func main() { gbot := gobot.NewGobot() - r := raspi.NewRaspiAdaptor("raspi") - adaFruit := i2c.NewAdafruitMotorHatDriver(r, "adafruit") + r := raspi.NewAdaptor() + adaFruit := i2c.NewAdafruitMotorHatDriver(r) work := func() { gobot.Every(5*time.Second, func() { - adafruitServoMotorRunner(adaFruit) }) } diff --git a/examples/raspi_adafruit_stepper.go b/examples/raspi_adafruit_stepper.go index 210e4fd1..e887da36 100644 --- a/examples/raspi_adafruit_stepper.go +++ b/examples/raspi_adafruit_stepper.go @@ -28,14 +28,14 @@ func adafruitStepperMotorRunner(a *i2c.AdafruitMotorHatDriver, motor int) (err e } return } + func main() { gbot := gobot.NewGobot() - r := raspi.NewRaspiAdaptor("raspi") - adaFruit := i2c.NewAdafruitMotorHatDriver(r, "adafruit") + r := raspi.NewAdaptor() + adaFruit := i2c.NewAdafruitMotorHatDriver(r) work := func() { gobot.Every(5*time.Second, func() { - motor := 0 // 0-based adafruitStepperMotorRunner(adaFruit, motor) })