Saturday, December 17, 2011

Using Linux to turn an LED indicator on via the serial port.

What I wanted to do was create a ready indicator where the LED would light up after it's finished booting. The only reason I needed this is because it's a headless system. (no monitor) I finally figured out how to turn one on via the serial port.

I wired it up like this:

Being as resourceful as possible I used a cd-rom audio cable since I only needed to work off two pins and I had one just laying around and the pin holes happened to be perfectly spaced.

I just had the script start running after the service that I was concerned about starts.

while :; do echo 'null' > /dev/ttyS1; sleep 0; done &

This results in an infinite loop of 'null' to be sent to the serial, causing the light to stay on.

Hope this info helps someone!