Hi,
How control GPIO in QT and produce interrupt when input go to from 1 to 0 .
Thanks
Hi,
How control GPIO in QT and produce interrupt when input go to from 1 to 0 .
Thanks
I try to use echo in Qt but is not work …do you know witch command I need to put in Qt . Also I think echoi command is too long for execution.
hi i try to blink gpio 104 on MX6DL using carrier board Aster …on gpio the led is connected … what is my problem :
#define PATH_LED_DIRECTION "/sys/class/gpio/gpio-104/direction"
#define GPIO_VALUE "/sys/class/gpio/gpio-104/value"
// Configure GPIO direction as Output
fdLedDirection = open(PATH_LED_DIRECTION, O_RDWR); // open file PATH_LED_DIRECTION in read/write mode
// parameter: open(filepath, read-write permissions)
// returns: file descriptor or -1 if an error occurred.
retVal = write(fdLedDirection, &outputString[0], sizeof(outputString)); // write into file to configure GPIO as output
// parameter: write(file_Descriptor, data_buffer, no_of_bytes),
// returns: No. of bytes written or -1 if an error occurred.
retVal = close(fdLedDirection); // close file with file descriptor
// parameter: open(filepath, read-write permissions),
// returns: 0 on success or -1 if an error occurred.
fdLedValue = open(GPIO_VALUE, O_RDWR); // Open file PATH_LED_VALUE in read/write mode
// parameter: open(filepath, read-write permissions),
// returns: file descriptor or -1 if an error occurred.
// Blink LED, by writing the I/O state value into the file: PATH_LED_VALUE
do {
led = (led == '1') ? '0' : '1' ; // Toggle led value, ASCII: '1' <----> '0'
retVal = write(fdLedValue, &led, 1); // write into file to update LED value - Low('0') or High ('1')
usleep(500000); // create a delay of 500 milliseconds
i++;
// get user input from keyboard
} while(i != 50); // exit if keyboard input is 'q'
retVal = close(fdLedValue); // close file with file descriptor
And what exactly does not work if add that code snippet into an application, compile it and run it on the target?
Assuming that you somewere else did export gpio 104.
my led not want to blink
Can you turn off and on that LED using sysfs manually?
i tried to use that direct in terminal : echo “in” > /sys/class/gpio/gpio104/direction but i have error : file or no directory
i can control it via GPIO Tool
What Dominik meant is:
echo 104 > /sys/class/gpio/export
echo "out" > /sys/class/gpio/gpio104/direction
echo 1 > /sys/class/gpio/gpio104/value
echo 0 > /sys/class/gpio/gpio104/value
… but i have error : file or no directory
Are sure that you did export the gpio to userspace before that?
i can control it via GPIO Tool
That only proofs that you connected the LED correctly.
The GPIO Tool works behind the kernel’s back directly with registers, that is something you only want for HW debugging purposes, but not for production code.