Denos2000
Posts: 3
Joined: Fri Jan 04, 2013 6:12 pm

Problem with wiringpi

Fri Jan 04, 2013 6:16 pm

Good nights:

I have a problem and I have this code:

#include
#include
#include

int main(void)
{
int setup = 0;
setup = wiringPiSetupSys();
if(setup != -1)
{ while(1)
{
printf(“Waiting.\n”);
waitForInterrupt(7, -1);
printf(“Caught interrupt\n”);
}
}
return(EXIT_SUCCESS);
}

I compile the code and i don’t have any problem
gcc -o test main.c -lwiringPi

Later I do:
gpio edge 7 falling

I execute the program and the program don’t receive nothing and I have this:
Waiting.

I hope you can help me.

texy
Forum Moderator
Forum Moderator
Posts: 5161
Joined: Sat Mar 03, 2012 10:59 am
Location: Berkshire, England

Re: Problem with wiringpi

Sat Jan 05, 2013 10:28 pm

Are you measuring the voltage on the correct pin?
Are you sure that what you think is 7 is the same 7 that the software is expecting?
T.
Various male/female 40- and 26-way GPIO header for sale here ( IDEAL FOR YOUR PiZero ):
https://www.raspberrypi.org/forums/viewtopic.php?f=93&t=147682#p971555

Denos2000
Posts: 3
Joined: Fri Jan 04, 2013 6:12 pm

Re: Problem with wiringpi

Mon Jan 07, 2013 11:18 am

Good morning:

I'm sure I have number port gpio good

Thanks for your interest.

User avatar
jojopi
Posts: 3274
Joined: Tue Oct 11, 2011 8:38 pm

Re: Problem with wiringpi

Mon Jan 07, 2013 11:53 am

Apart from the formatting issues because it is not in a

Code: Select all

 block, the program is correct.  It works for me.

User avatar
gordon@drogon.net
Posts: 2020
Joined: Tue Feb 07, 2012 2:14 pm
Location: Devon, UK
Contact: Website

Re: Problem with wiringpi

Mon Jan 07, 2013 7:45 pm

Just to be sure - the pin7 referede to here is the SPI CE1 pin - that's physical pin 26 on the header.

You will also need to bias the pin to 3.3v to detect a falling level - unless the circuit you're driving it with alreasdy does that (ie. if it's a login output then you're fine, if a button you might not be). You can use the internal resistors - gpio -g mode 7 up.

Remember that in "Sys" mode (and using the gpio level command) the pin numbers are the native BCM_GPIO pin numbers and not the wiringPi pin numbers.

-Gordon
--
Gordons projects: https://projects.drogon.net/

Return to “Automation, sensing and robotics”