Bx-24 Remote control cars and a drag race timer

Started by hightechhousecall November 25, 2007
Hello world (sorry had to do that)

The last time I used my bx24 was in 2003
I set up a program to read MPH with 2 phototransistors
set 10' apart.
worked fine we had fun, life goes on.....

OK now I have been asked to make a Drag Race timer.
So I have dusted off the old proto board
and here we go.

Standard 2 lane race
1/10th scale
track is 132' long
Cars are at around 60mph at the finish line
And elapsed time is around 2 sec.
The first proto will only be installed at the end of track
with the sensors 12" apart
It will need to set off a win light
and a read out the speed in mph of each car
independent of each other win or lose
Any links to others that have worked timing (race) projects
would be a great help.

The code I used for mph timer was ok for 1 lane
but how to expand it to read 2 lanes has got me stumped
I may end up with 2 bx24's (one for each lane)
then link them for a win light and add a few lines for
the winning lane.
That would allow me to expand it later for a start line sensor
and elapsed time.
this is how I went about the old project
I am a hardware tech and there is much that I don't
understand about code.

Option Explicit

Dim ElapsedTime As Single
Dim Divider As Single
'Dim multiplier As Single
Dim Answer As Single
'===================================Const BLANK as Integer = &H00
Const GreenLED As Byte = 26
Const RedLED As Byte = 25

Const LEDon As Byte = 0
Const LEDoff As Byte = 1

'===================================Public Sub Main()
Call InitializeTimer(5)

Call OpenSerialPort(1, 19200)
'======================================Call Bills()

Call Delay(5.0)
Loop until GetPin(5) = 0 ' wait until point 1 is at 0
Call StartTimer()
Debug.print "< Timer Started >"
Call PutPin(GreenLED, LEDon)
If (TimerHasOverflowed) Then
CALL initializeTimer(5)
Call PutLine("Overflow")
Call PutPin(GreenLED, LEDoff)
Loop until GetPin(6) = 0 ' wait until point 2 is at 0

call PauseTimer()
Debug.print "< Timer Stoped >"
Call PutPin(GreenLED, LEDoff)
Call PutPin(RedLED, LEDon)
call GetTimerValue (ElapsedTime)
'Call GetTimerValue(ElapsedTime)

Call PutStr( CStr(ElapsedTime) )
Call PutLine(" sec ")

Divider = 6.81818
'Multiplier = 0.1466666
Answer = Divider / ElapsedTime
Call PutStr( CStr(Answer) )
Call PutLine(" MPH ")
Call SSoutLED (Answer)
'delay (10.0)

Call PutPin(RedLED, LEDoff)
Call PutPin(GreenLED, LEDoff)
'Call Max7219Blank(1)
goto loop1
end sub

I just bit/bang the answer to a Max7219 and out to four 7 seg.Led
But I will change to a seral LCD display in the near future

Thanks for looking
Billy King
P.S. the BX-24 is NOT dead
(mine works fine)
Thanks Tom, I am reading up now. be back soon.