I used NQC (Not Quite C) to program the Lego RCX unit
There are two sensors that detect the dit and dah paddles and the third wire lights a light that blinks in unison with the beeping dits and dahs. (That was for my 2 and 4 year old daughters... beeping is cool, but visual input rocks! :-)
It's not too precise, but works. Fun homebrew project, that's for sure!
Here is the code written to the RCX in NQC.
#define DIT SENSOR_3
#define DAH SENSOR_1
#define LIGHT OUT_B
#define DITLEN 7
// Dah length normally 3* ditlength
#define DAHLEN 21
#define TONE 900
task main()
{
#ifdef __RCX
// RCX needs to be told what kind of sensor is used
SetSensor(DIT, SENSOR_TOUCH);
SetSensor(DAH, SENSOR_TOUCH);
#endif
// loop
while(true)
{
if(DIT == 1)
{
On(LIGHT);
PlayTone(TONE, DITLEN);
Wait(DITLEN);
Off(LIGHT);
Wait(DITLEN);
}
if(DAH == 1)
{
On(LIGHT);
PlayTone(TONE, DAHLEN);
Wait(DAHLEN);
Off(LIGHT);
Wait(DITLEN);
}
}
}