Sunday, July 29, 2012

Old story found 

I found a dot matrix printout of a story I wrote in perhaps high school.  I guess the best way to preserve it is to put it online, given that this piece of paper is the only record I have.


The old man turned away as the door opened.  Even though he was blind, he cringed as the bright light from outside poured in.

"I have a present for you" says the visitor, his dark eyes squinting to read the face of the old man who always seems to gravitate to the darkest corner of the room.

"I don't want your presents," mumbled the old man.  "I like my room the way it is.  Why do people always bring me new things, when they only confuse me?"  He reached out and took the parcel.  In it he felt the rounded shape of an egg, nestled in a bed of hay.  Perhaps it will be a song bird to keep me company, he thought.

The poor man, thinks the visitor, guilt forcing his eyes closed.  It is good he is blind.  He cannot see how disfigured he is.  "It is only me again.  I am sorry I did this to you," he whispers, and leaves.

"Again."  The word was like a voice in a cavern, each echo slightly different.  I am getting old, thought the old man.  I keep forgetting his name.

The visitor comes to see the old man again, and this time he is sleeping.  The nest sits on the table beside the bed, but the egg is split.  The small form wriggles out, looking so delicate.  "I am free," says the visitor.

The old man awoke, and checked the egg.  A smile appeared on his face as he felt the shards.  Tenderly he felt around the nest, and held the small creature in is hand.  It was not right.  As his hand closed to crush the newborn snake it bit into the flesh of his palm.

Wednesday, July 18, 2012

Adventures in hardware - Parallel Port and LEDs 

Goal: Blink some lights from the computer.

Parts: Computer with Parallel port and a cable. LEDs (From Radio Shack, 3VDC, 20mA).  Resistors, multimeter, and calculator.  Python and the parallel module from the pySerial sourceforge project.

Python: Makes this more simple than C for me.

On Debian, apt-get install python-parallel.
rmmod lp
modprobe ppdev
Add myself to the lp group to I can write to /dev/parport0

import sys
import parallel
s = int(sys.argv[1])
parPort = parallel.Parallel()

Electronics: Don't want to burn out the LED or the computer.
Pin 2 is first data pin, pin 3 is second, etc.  Pin 25 works as ground.
Using multimeter, discover 3.3 volts coming across the cable.
3.3 volts minus the 3 volts of drop from the LED leaves .3 volts.  How much resistor to get this down to 20mA? .3 divided by 20 = 0.015 k ohms or 15 ohms.  Smallest resistor I have is 100 ohms, but it works.
LED orientation is flat side to pin 25.

Use: Command line fun.
The python script might be called blink.py, and you need to treat the LEDs as binary.  I just call "./blink.py 1" to turn on the first pin. "./blink.py 2" to turn on the second, "./blink.py 3" to turn on both, "./blink.py 0" to turn them all off.

Armed with this setup and some Unix pipes, I can blink based on all kinds of events.  Yay!

This page is powered by Blogger. Isn't yours?