Comments (6)
Hi @curiositry,
Sorry to hear it didn't work. I don't know if the Zero has been tried but can't think of any specific reason it wouldn't work.
Just to confirm, do you have a /sys/class/gpio directory?
from gpio.
Thanks for responding @brian-armstrong β yes, /sys/class/gpio
does exist.
from gpio.
@curiositry I can think of one thing, after rereading some of my code. It looks like the Watcher will not fail gracefuly if you Close it before calling Watch. If you did that, Watch would just hang forever.
Just to be sure, could you share the code that uses the Watcher, or make sure that it isn't somehow getting Closed prematurely?
from gpio.
@brian-armstrong Thanks for your help. Here are the relevant portions (I was basically just testing it with whatβs in the README):
pin := gpio.NewInput(7)
fmt.Println(pin.Read())
watcher := gpio.NewWatcher()
watcher.AddPin(7)
defer watcher.Close()
for {
fmt.Println("Starting watcher.")
pin, value := watcher.Watch()
fmt.Print("Watcher value: ")
fmt.Println(pin)
fmt.Print(value)
}
It would hang at pin, value := watcher.Watch()
without printing anything.
from gpio.
Hi Brian
I had similar experience with go 1.9 and a raspberry pi model 1. I tracked the issue down to the way the fdset is built in the watcher :
fdset.Bits[val/64] |= 1 << uint(val) % 64 is not working on my set-up.
and should be fixed as fdset.Bits[val/64] |= 1 << (uint(val) % 64)
https://play.golang.org/p/HyV6wX-aihG
I propose you a PR to fix this.
from gpio.
Hello,
I've go 1.9.7 and the code is correctly fixed as per last olb17 message, but after some acquisitions the Watcher stops to detect pin changes even if using 'cat' I can see the gpio change.
I want to detect the falling edge so I put Falling instead of Both inside the watcher.
from gpio.
Related Issues (12)
- it's works on NenoPi NEO2
- GPIO0-GPIO7 Always High
- openPin() architect improvement HOT 1
- Issues on RPI3B+ HOT 2
- Issues on Pi Zero W
- failed to call syscall.Select, interrupted system call HOT 1
- Support/expose channels HOT 2
- De-jankify select() call HOT 1
- Other sysfs peripherals HOT 1
- Wrong permissions + Timing issue in NewOutput/NewInput HOT 2
- Non-blocking way to catch the pin change events ? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gpio.