Sign in

username:

password:



Not a member?

Search basicx



Search tips

Subscribe to basicx



basicx by Keywords

Accelerometer | ADC | ADXL | Adxl20 | AVR | BasicStamp | BX-35 | BX28 | BX35 | COM3 | Compiler | Downloader | EEPROM | Electromagnet | GetADC | GP2D1 | GPS | I2C | IDE | Keypad | LCD | LCD+ | MIDI | Motors | Multitasking | Netmedia | Networking | PCB | PID | PlaySound | PWM | Relays | RTC | Servo | ShiftOut | SitePlayer | SPI | Stack | Timer | USB

Ads

Discussion Groups

See Also

DSPFPGAElectronics

Discussion Groups | BasicX | Bx-24 Remote control cars and a drag race timer

Discussion forum for the BasicX family of microcontroller chips.

Bx-24 Remote control cars and a drag race timer - hightechhousecall - Nov 25 12:07:05 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()

Loop1:
Call Delay(5.0)
Do
Loop until GetPin(5) = 0 ' wait until point 1 is at 0
Call StartTimer()
Debug.print "< Timer Started >"
Call PutPin(GreenLED, LEDon)
Do
If (TimerHasOverflowed) Then
CALL initializeTimer(5)
Call PutLine("Overflow")
Call BAD_PASS()
Call PutPin(GreenLED, LEDoff)
GOTO LOOP1
END IF
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
displays.
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)



(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )


Re: Bx-24 Remote control cars and a drag race timer - Billy - Dec 14 17:36:36 2007



Thanks Tom, I am reading up now. be back soon.



(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )