Hi Curtis,

I used to play a bit with a Beaglebone Black a few years ago, but it's now 
gathering dust at my father's place. I really liked it at the time.

Can you double check that you are correctly using your *work := func() ...* 
construct ?

Here's what that documentation of the gobot.NewRobot initializer says 
at: https://github.com/hybridgroup/gobot/blob/master/robot.go#L104
"func(): The work routine the robot will execute once all devices and 
connections have been initialized and started"

Could it be that your two *"button.On(...)"* handlers are actually only 
executed once, then they are lost for ever ?

Maybe you can try using the Subscribe method 
? https://github.com/hybridgroup/gobot/blob/master/eventer.go#L108

e,g, *myEventsChan := button.Subscribe()*  (just before the *work := func()* 
block , then launch a go routing with that channel as a parameter ? )

Just a thought

Cheers,
Silviu


On Sunday, 11 February 2018 23:21:57 UTC-5, Curtis Paul wrote:
>
> Anybody out there have any experience with BeagleBone Black and gobot?
> I need some advice on how I could go about troubleshooting this...or if 
> you know what the issue is, etc...
>
> I have a very simple Gobot/GPIO Button circuit.  
> It should show output when button is pushed and then again when released, 
> but it doesn't do anything.
> It's not working.
>
> Running image BBB-blank-debian-9.3-iot-armhf-2018-02-04-4gb.img.xz.  (I 
> also tried the version posted on the BeagleBone site)
> Modified /boot/uEnv.txt according to instructions at 
> https://gobot.io/documentation/platforms/beaglebone.
>
> I can see all the gpio's in /sys/class/gpio.
>
> I'm using gpio67, so I cat the value file and see 0 when button is not 
> pushed, then see 1 when button is pushed.  I know my circuit is good.
>
> This is my gobot code for interacting with the button:
> FYI...P8_8 is gpio67
>
> 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()
>         button := gpio.NewButtonDriver(beagleboneAdaptor, "P8_8")
>
>         work := func() {
>                 button.On(gpio.ButtonPush, func(data interface{}) {
>                         fmt.Println("button pressed")
>                 })
>
>                 button.On(gpio.ButtonRelease, func(data interface{}) {
>                         fmt.Println("button released")
>                 })
>         }
>
>         robot := gobot.NewRobot("buttonBot",
>                 []gobot.Connection{beagleboneAdaptor},
>                 []gobot.Device{button},
>                 work,
>         )
>
>         robot.Start()
> }
>
>
> This is what it looks like when the code runs.  No errors, etc...
> Push the button and don't get any of the Println's.
>
> 2018/02/12 04:14:03 Initializing connections...
> 2018/02/12 04:14:03 Initializing connection BeagleboneBlack-65FB3BAE ...
> 2018/02/12 04:14:03 Initializing devices...
> 2018/02/12 04:14:03 Initializing device Button-51E1127C ...
> 2018/02/12 04:14:03 Robot buttonBot initialized.
> 2018/02/12 04:14:03 Starting Robot buttonBot ...
> 2018/02/12 04:14:03 Starting connections...
> 2018/02/12 04:14:03 Starting connection BeagleboneBlack-65FB3BAE...
> 2018/02/12 04:14:03 Starting devices...
> 2018/02/12 04:14:03 Starting device Button-51E1127C on pin P8_8...
> 2018/02/12 04:14:03 Starting work...
>
> I should be seeing "button pressed" when I press the P8_8 button....but I 
> don't see anything.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to