Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cant start gobot with raspberry pi adapter and servo driver #166

Closed
razic opened this issue Dec 21, 2014 · 9 comments
Closed

Cant start gobot with raspberry pi adapter and servo driver #166

razic opened this issue Dec 21, 2014 · 9 comments

Comments

@razic
Copy link

razic commented Dec 21, 2014

here is my code:

package main

import (
        "github.com/hybridgroup/gobot"
        "github.com/hybridgroup/gobot/platforms/gpio"
        "github.com/hybridgroup/gobot/platforms/raspi"
        "log"
        "time"
)

func main() {
        gbot := gobot.NewGobot()
        r := raspi.NewRaspiAdaptor("raspi")
        servo := gpio.NewServoDriver(r, "servo", "23")
        work := func() {
                gobot.Every(10*time.Second, func() {
                        i := uint8(gobot.Rand(180))
                        log.Printf("Moving servo to %d", i)
                        servo.Move(i)
                })
        }
        robot := gobot.NewRobot(
                "servoBot",
                []gobot.Connection{r},
                []gobot.Device{servo},
                work,
        )

        gbot.AddRobot(robot)
        gbot.Start()
}

and this is the error is get

./main.go:14: cannot use r (type *raspi.RaspiAdaptor) as type gpio.Servo in argument to gpio.NewServoDriver:                                                                                                        │
        *raspi.RaspiAdaptor does not implement gpio.Servo (missing InitServo method)

any suggestions?

@zankich
Copy link
Contributor

zankich commented Dec 22, 2014

@razic The problem is that the raspberry pi adaptor does not currently support pwm. In order for pwm to work we need to implement support for pi blaster https://github.com/sarfata/pi-blaster.

@razic
Copy link
Author

razic commented Jan 3, 2015

@zankich great. sounds like we're almost there. is it possible you would be able to explain on a high level a bit more in-depth what it would take to get the pi blaster support going?

correct me if i'm wrong, but it seems like pi-blaster is either a process or a script that needs to be run at least once. then, we can write values to /dev/pi-blaster?

@zankich
Copy link
Contributor

zankich commented Jan 3, 2015

@razic I created a branch with initial pi-blaster support https://github.com/hybridgroup/gobot/tree/raspi_pwm. In order to get this to work you'll have to follow the installation instructions for pi-blaster. I don't currently have access to a raspberry pi, so I only tested locally with manually verifying values and it should work.... If you're feeling brave you can check out that branch and let me know how it goes!

@SellJamHere
Copy link

Has there been any further work on PWM support?

@zankich
Copy link
Contributor

zankich commented Jun 30, 2015

@razic and @SellJamHere pwm support has just landed in the master branch. You need to follow the instructions here to enable PWM pins.

@edgarsilva
Copy link

We should close this since pwm support has been added, or are we waiting for release?

@zankich
Copy link
Contributor

zankich commented Jul 3, 2015

This has been released and I tested with a servo and led on a raspi b+

@zankich zankich closed this as completed Jul 3, 2015
@matipan
Copy link

matipan commented Oct 8, 2018

@zankich Do you have an example I could follow? I'm trying with a MG90 servo tower connected to GPIO 11 on a pi b+ but it does not seem to be working

@deadprogram
Copy link
Member

You might want to open a new issue @matipan this one has been closed for a long time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants