home bbs files messages ]

Just a sample of the Echomail archive

Cooperative anarchy at its finest, still active today. Darkrealms is the Zone 1 Hub.

   RBERRYPI      Support for the Raspberry Pi device      21,939 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 20,340 of 21,939   
   =?UTF-8?Q?Josef_M=C3=B6llers?= to All   
   how to write and read back GPIO pin stat   
   04 Aug 24 22:13:55   
   
   INTL 3:770/1 3:770/3   
   REPLYADDR josef@invalid.invalid   
   REPLYTO 3:770/3.0 UUCP   
   MSGID:  51fa60dd   
   PID: SoupGate-Win32 v1.05   
   Hi,   
      
   I used to use the sysfs interface to the GPIO pins (/sys/class/gpio) but   
   I understand that is deprecated nowadays. So I tried to switch to lgpio   
   which looks OK. However, I have problems writing and reading back pin   
   states from different programs.   
      
   My setup is as follows:   
   I have a couple of relays (solid state and mechanical ones) that control   
   various external devices.   
   I use one program to switch devices on and off and want to use another   
   program to read back the state of the device.   
      
   Doing that with sysfs is easy:   
   1) export the pin:   
          echo $pin > /sys/class/gpio/export   
          echo $direction > /sys/class/gpio/gpio$pin/direction   
       this needs to be done only once.   
   2) write the state of the pin, thus switching the device on/off:   
          echo $newstate > /sys/class/gpio/gpio$pin/value   
       this is done every time this is required   
   3) read back the state of the pin   
          value=$(Usenet Gateway (3:770/3)   
   SEEN-BY: 19/38 90/1 105/81 106/201 129/305 153/757 7715 218/700 840   
   SEEN-BY: 220/70 226/17 30 100 227/114 229/110 111 200 206 300 317   
   SEEN-BY: 229/400 426 428 470 550 616 664 700 266/512 267/800 282/1038   
   SEEN-BY: 291/111 292/854 310/31 320/219 322/757 342/200 396/45 460/58   
   SEEN-BY: 633/280 281 412 418 420 509 2744 712/848 770/1 3 100 330   
   SEEN-BY: 770/340 772/210 220 230 5020/400 5075/35   
   PATH: 770/3 1 633/280 229/426   
      

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca