Carpenter
Posts: 3
Joined: Mon Jun 10, 2019 2:23 pm

Counter and timer on Raspberry Pi 2?

Mon Jun 10, 2019 2:38 pm

Hello I.
I am a newbie in the area programing Rapberry PI and i need. every minute to log the number of pulses on one of the GPIOs.
In other words, I need an example
use interupt function , where is called on rising edge of GPIO input
use Interval Timers function, where is called for elapsed time (60s)

dsyleixa123
Posts: 293
Joined: Mon Jun 11, 2018 11:22 am

Re: Counter and timer on Raspberry Pi 2?

Mon Jun 10, 2019 3:56 pm

hi,
have you already taken a look at wiringPi? At least for convenient timer and GPIO r/w and interrupt functions it works (mostly):
http://wiringpi.com/
https://github.com/WiringPi/WiringPi/tr ... r/examples
(this is an unofficial repo mirror, unfortunately I don't know an "official" repo in the web)

if you want to install on Raspbian:
- be careful: it already comes preinstalled on standard Jessie and Stretch (but not on LITE)
- for reinstall or new install always only use:

Code: Select all

sudo apt-get update
sudo apt-get upgrade
sudo apt install wiringpi
- DON'T use git clone..., especially if it was installed already before as a package!
(the install guide at wiringpi.com IMO is extremely puzzling!)


dsyleixa123
Posts: 293
Joined: Mon Jun 11, 2018 11:22 am

Re: Counter and timer on Raspberry Pi 2?

Mon Jun 10, 2019 5:02 pm

hello, Mr or Mrs (?) Joan,
I always have been interested in pigpio but could not find an easy access to it yet....
do you have a repo listing all your single functions and related examples ?
Or perhaps something like cplusplus.com how they are listing all C/C++ functions by definitions, descriptions and feat. short examples and related links, by an alphabetical order?
e.g. like shown and provided in this example: http://www.cplusplus.com/reference/cstdio/fopen/ ?


dsyleixa123
Posts: 293
Joined: Mon Jun 11, 2018 11:22 am

Re: Counter and timer on Raspberry Pi 2?

Mon Jun 10, 2019 5:38 pm

thanks, yes, I seen that already long time ago... ;)
BTW: Mr or Mrs ? ;)

Return to “C/C++”