Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 15543

Need a little vb programming help please...

$
0
0
I'm building a 30' long racetrack (dragstrip) for children to have fun with at charity events we do in our area. In the past, I've used a PLC to control the track and turn LED's on for the fastest times. However, I would now like to add a computer display where they could see their actual times and the corresponding miles per hour (mph) for each lane as well. The track has four lanes which will send out a simple closed circuit (relay) when the car passes the photosensor. This then feeds into a laptop where I have a timing program partially completed in vb that displays the times in a simple ListBox. I found code to do this and the timer works fine.

The problem is that I have no idea how to convert these times into mph using vb code. I know that I will enter (only once) the distance that they have traveled by each time displayed in the ListBox and that should give me the mph for each of four blocks labeled First, Second, Third and Fouth. The distance will be determined so so that it makes the children feel good about how fast their car was going, i.e., I want it to look like they are traveling 200-300 mph. I cannot tell you what the distance number will be yet in that this track is not finished yet and I will have to run some cars on it before deciding what number to use.

I have tried for days to read documents available and/or find an example that would help me complete the code but have yet found the answer. I would really appreciate it if someone out there who knows vb could help me complete the code. I'm 70 and on a fixed income, but I am willing to pay for some help if it doesn't take too long.

So here is what I still need. The program starts when the starting gate drops and sends a command to the program which is the same as entering the enter key on the keyboard. I do this by sending a closed circuit to the computer telling it that the "enter" button has been pushed. This starts the clock running and works fine. Now in order for the enter key to be used for displaying the times, you have to push the "Tab" key on the keyboard (or use the mouse which I do not want to do) to highlight the "Lap" button in the program. Now, as the cars pass the finish line, each lane basically sends a closed circuit or "enter" command to the computer which in turn logs the four times. This also works fine. The problem is how to write the code to calculate the mph (the distance determined by me as a fixed number / elapsed time) and display it in each of the four boxes listed under mph. So there are two things I still need. 1) How to code it so that it will jump from the Start button to the Lap button after it is given the start command, and 2) how to take each time and divide it into the fixed (and yet to be determined) distance I choose to calculate the mph and display the numbers in the four boxes.

The timing program display looks like this...

Name:  Ashampoo_Snap_Monday, October 26, 2020_20h36m28s_001_.jpg
Views: 34
Size:  43.0 KB

The code so far looks like this...

I've got to find the code and put it into a pdf file before the time runs out on this section. Will post it within
the next few minutes...
Attached Images
 

Viewing all articles
Browse latest Browse all 15543

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>