examples: Correct adafruit examples to use new drivers package location

Signed-off-by: deadprogram <ron@hybridgroup.com>
This commit is contained in:
deadprogram 2016-10-15 19:55:43 +02:00
parent 6c1e392b18
commit 64ae34f40f
3 changed files with 10 additions and 9 deletions

View File

@ -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() {

View File

@ -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)
})
}

View File

@ -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)
})