BeagleBone Black, Debian 9.5 2018-10-07 image - Go 1.10, installed Gobot using go.
I'm new to Gobot and Go. I've adapted the stepper example
here to work with the BeagleBone Black using the information about the adapter
here. I ended up with this code:
package main
import (
"fmt"
"gobot.io/x/gobot"
"gobot.io/x/gobot/drivers/gpio"
"gobot.io/x/gobot/platforms/beaglebone"
)
func main() {
beagleboneAdaptor := beaglebone.NewAdaptor()
stepper := gpio.NewStepperDriver(beagleboneAdaptor, [4]string{"P8_13", "P8_14", "P8_15", "P8_16"}, gpio.StepperModes.DualPhaseStepping, 2048)
work := func() {
//set spped
stepper.SetSpeed(15)
//Move forward one revolution
if err := stepper.Move(2048); err != nil {
fmt.Println(err)
}
//Move backward one revolution
if err := stepper.Move(-2048); err != nil {
fmt.Println(err)
}
}
robot := gobot.NewRobot("stepperBot",
[]gobot.Connection{beagleboneAdaptor},
[]gobot.Device{stepper},
work,
)
robot.Start()
} I get the following error when trying to run the code from inside the Cloud 9 IDE on the BBB.
write /sys/class/gpio/export: operation not permitted
pin has not been exported
I have checked to make sure that the GPIOs that I'm using are in /sys/class/gpio, and they are. I can run an equivalent example in Python and it works fine.