how to switch gpio from ext connector from terminal


May 22, 2013

once there was a description how to switch the LEDs from command line but I could´nt find it. Maybe someone can give me the link. I want to switch the GPIO from the ext connector for exernal hardware. Maybe I can use the same procedure or someone can give me a small example how to do it from command line.

thank you
thanks for the quick response.

The link was very helpful. The example is working so far - no more errors after correcting the syntax. I want to drive an external LCD for messages, maybe by selfmade I2C so I need only 2 lines. Next is the hardware (optocoupler for levelshift, LCD etc.) for real test.

Thanks again (LED is working too).

so far the prototype is working : LCD 2x16 with optocoupler as levelshift and a counter ic so I need just 2 port pins for driving it.

thanks for the help!
here are some pics

first the ext adaptor

then the parts left is  a 7bit counter 4024, right 4x optocoupler SFH 620

last is LCD with test out



@thatgui  this was just as a proof of concept for switching the GPIOs and output on LCD, but maybe later I can use this for showing info when the lid is closed (maybe a clock with alarm and a beeper for alarm). Another idea is an info terminal for home control i.e. temperature control.
Interesting. I wonder why you used optocouplers rather than the transistor-based buffer design that I'm more used to. I can't see any downside to your design - bandwidth should be high enough and I guess it gives you better isolation, but it's new to me, that's all.
I've used optocouplers long ago with the input pins of a parallel port interface I made in High School... but I think my Electronics teacher thought I'd blow up the computer.
@ LEvi:

this was just for isolation purpose, in case there is a short circuit while building the prototype or while measuring so I won´t kill something of the pandora. "It´s better to be safe than sorry" ;-)