I need to write two program for raspberry pi 3. In program 1 I define some pins as output and set a value on it then I want to get state(value) of those pins in program 2 in another word I want to set a value to pins in a process and read the values in another process when I want - I using raspbian
Asked
Active
Viewed 1,671 times
0
-
You could use `mmap()` in both programs to map an area of memory to be shared between the two processes. The program setting the GPIO pins could write the status in the shared memory and the program needing to know the status could read it from the shared memory. – Mark Setchell Oct 19 '18 at 09:06
1 Answers
1
With function GPIO.gpio_function(pin)
you can determine if pin is set like INPUT or OUTPUT.
To check if INPUT is HIGH or LOW, you can use if(GPIO.input(channel)==GPIO.LOW))
or if(GPIO.input(channel)==GPIO.HIGH))
Hope, it was helpful for you.

Koxo
- 507
- 4
- 10