kidoman / embd

Embedded Programming Framework in Go
http://embd.kidoman.io
MIT License
1.28k stars 157 forks source link

PWM on RPi B+ not working #34

Closed akofoed closed 8 years ago

akofoed commented 9 years ago

Thanks for the cool EMBD framework. It's really great.

I see in the docs for the PI B+ that the GPIO18 should work as PWM pin. However it's not supported in the host (host/rpi/rpi.go).

I get this if I try:

Error in NewPWMPin (18)! panic: gpio: pwm not supported on this host

Code:

    pinNo := 18
    pwm, err := embd.NewPWMPin(pinNo)
    if err != nil {
        fmt.Println("Error in NewPWMPin (18)!")
        panic(err)
    }
    defer pwm.Close()
    // 500 Hz == 2.000.000 ns
    pwm.SetDuty(2000000)
scruplelesswizard commented 7 years ago

@akofoed did you resolve this, or are the doc's incorrect on supporting PWM for the Pi?

akofoed commented 7 years ago

Hi chaosaffe No, I wrote it in C, so problem solved.