Skip to content

Commit

Permalink
examples: Correct adafruit examples to use new drivers package location
Browse files Browse the repository at this point in the history
Signed-off-by: deadprogram <[email protected]>
  • Loading branch information
deadprogram committed Oct 15, 2016
1 parent 6c1e392 commit 64ae34f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
6 changes: 3 additions & 3 deletions examples/raspi_adafruit_dcmotor.go
Original file line number Diff line number Diff line change
Expand Up @@ -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!
Expand All @@ -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() {
Expand Down
7 changes: 4 additions & 3 deletions examples/raspi_adafruit_servo.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
})
}
Expand Down
6 changes: 3 additions & 3 deletions examples/raspi_adafruit_stepper.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
})
Expand Down

0 comments on commit 64ae34f

Please sign in to comment.