morbak
Posts: 1
Joined: Wed Apr 23, 2014 9:22 am

GPIO reading time

Wed Jun 13, 2018 6:20 pm

Hi,

I'm using WiringPi library and i've a strange behaviour when i wanted detect rising or falling edge on the CLK (ie):
It seems i can dectect the 1st change of state, but the second isn't detected all the time,

Code: Select all

				
while(1)
{
	if (digitalRead(RSPI_CLK)==0)
	{
		//digitalRead(RSPI_CLK);
		//digitalRead(RSPI_CLK);
		if (digitalRead(RSPI_CLK)==1)						// RISING
		{
			//bit= digitalRead(RSPI_CLK);
			digitalWrite(RSPI_A,1);
		}
	}
	digitalWrite(RSPI_A,0);
}
Image

I don't understand why the state High isn't detected every time, theres' no instruction using time.
So i focus on the digitalRead() function i think using 2 functions is using too much time to detect or ...

I someone have an idea, it'll be great

thx,
Attachments
2018-06-13_19h31_12.png
2018-06-13_19h31_12.png (12.77 KiB) Viewed 287 times

Return to “C/C++”

Who is online

Users browsing this forum: No registered users and 5 guests