Pages: [1]   Go Down
Author Topic: 4 lane pinewood derby timer - newb  (Read 366 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi guys,
I am trying to modify code for a 2 lane pinewood derby timer to make it detect and time 4 lanes.  This is the circuit schematic for the 2 lane version:

http://db.tt/vzhPBtof

This is the original code:

http://db.tt/llqDfCY1

And these are my modifications:

http://db.tt/pfHrgIPb

I am a newb, and I would love to know 1. will this work? and 2. Are there ways to improve this code?  Any help would be much appreciated.  I am trying to learn both coding and making circuits with this project.
Thanks in advance.
Logged

Topsham, Vermont USA
Offline Offline
Edison Member
*
Karma: 32
Posts: 1866
... in The Woods In Vermont
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,
This looks OK, (without being able to run it).. Pins look OK...

Are you having problems?

You could breadboard this with the LEDS/Phototransiostors just pointing at each other and use your hand to 'simulate' cars...

Some low-cost parts here:   Infrared http://goo.gl/Wh093


DISCLAIMER: Mentioned stuff from my own shop...
Logged

Regards, Terry King terry@yourduino.com  - Check great prices, devices and Arduino-related boards at http://YourDuino.com
HOW-TO: http://ArduinoInfo.Info

South Texas
Offline Offline
Edison Member
*
Karma: 8
Posts: 1024
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

It is not readily available, but -

There is another way of accessing I/O that has some potential for problems...

Search for PORTB and DDRB and PINB (and PIRTC, DDRC, PORTD and DDRD

These are ways of accessing a port directly so that you can read or write multiple pins at one time.

You can still set up the pins in the normal method and then use PORTB to read them.
If you look at the Arduino pinouts you will notice that they have notoation like this
328    Arduino
PB0    D8
PB1    D9
PB2    D10
PB3    D11

so you could do a quick read of pins d8 through d11

   MyVar = PORTB and 15
if myvar = 1 then track 1 was tripped
= 2 then track 2, 4 tehn track 4 and 8 would be track 4.
Combinations would mean that there was a tie.

you could then loop waiting for finisher 1, another loop for finisher 2, another loop for finisher 3 and then assume that finisher 4 was whoever is left.

When you check each bit individually you are increasing the chance that you will miss a car if they are close.
Logged

Pages: [1]   Go Up
Jump to: