Cub scouts need some guidance.
PennState'R
Posts: 1
Hello, I am a cub scout pack leader and our den has been asked to build a project for our upcoming pinewood derby race in 2 weeks.· We have been asked to build a starting gate christmas tree like you would see at a drag racing strip.· Our track has 4 lanes and we are designing our christmas tree to have 4 individual light sequences.· We have prototyped our electrical circuits on a prototype board with jumpers to·the BS2 Inputs/outputs.· We are using 8 Darlington Arrays, and 24 lights made up of 24 leds each and 2 external 24volt 2.5amp power supplys.· Our tests seem to work very well with the program I have attached below.· Since no one in our pack is experienced with electronics, we have a couple of questions that we need direction or guidance on.· First, how does our code look?· We made the code up completely from the first couple of chapters in the BS2 manual.· Second, I know that we do not want to permanently attach the BS2 to the christmas tree, how do we take the code we wrote and the circuits we made and put them into the christmas tree so that its a stand alone device?· We need all 16 I/O ports and we need to have 5 volts somewhere for the switches.
Here is our code:
' Cub Scout Pack 529 Christmas Tree
' Pinewood Derby
' Christmas Tree Program
' {$STAMP BS2}
' {$PBASIC 2.5}
DO
· DO
· ' Waiting for activation of start button
· LOOP UNTIL IN3 = 1
' Check if there is a car in Lane 1 - prox sensor
IF (IN11=1) THEN
· ' Authorize Lane 1 lights to sequence
· HIGH 13
ELSE
· ' Prevent Lane 1 lights from Lighting if no car in lane 1
· LOW 13
ENDIF
' Check if there is a car in Lane 2 - prox sensor
IF (IN10=1) THEN
··· ' Authorize Lane 2 lights to sequence
· HIGH 12
ELSE
· ' Prevent Lane 2 lights from Lighting if no car in lane 2
· LOW 12
ENDIF
' Check if there is a car in Lane 3 - prox sensor
IF (IN2=1) THEN
··· ' Authorize Lane 3 lights to sequence
· HIGH 6
ELSE
··· ' Prevent Lane 3 lights from Lighting if no car in lane 3
· LOW 6
ENDIF
' Check if there is a car in Lane 4 - prox sensor
IF (IN1=1) THEN
··· ' Authorize Lane 4 lights to sequence
· HIGH 5
ELSE
··· ' Prevent Lane 4 lights from Lighting if no car in lane 4
· LOW 5
ENDIF
' Christmas Tree Sequence
PAUSE 500
' First Orange Series Lights and tone
HIGH 15
FREQOUT 9,250,1318
PAUSE 500
' Second Orange Series Lights and tone
HIGH 14
FREQOUT 9, 250,1318
PAUSE 500
' Third Orange Series Lights and tone
HIGH 8
FREQOUT 9, 250,1318
PAUSE 500
' Green GO Series Lights, tone, and starting solenoid
HIGH 7
HIGH 4
FREQOUT 9, 1000, 2793
PAUSE 4000
' 4 second race time then begin returning lights and solenoid to off/home·position
' Staggered lights returning to off position to prevent surges
LOW 7
PAUSE 400
LOW 8
PAUSE 400
LOW 14
PAUSE 400
LOW 15
PAUSE 400
LOW 13
PAUSE 100
LOW 12
PAUSE 100
LOW 6
PAUSE 100
LOW 5
PAUSE 100
LOW 4
PAUSE 500
' Signal to notify that system is returned to ready state for next race.
FREQOUT 9,250,1158
LOOP
END
Thanks in advance for any assistance or directions given.
Sincerely
Cub Scout Pack 529 Future Engineers
Here is our code:
' Cub Scout Pack 529 Christmas Tree
' Pinewood Derby
' Christmas Tree Program
' {$STAMP BS2}
' {$PBASIC 2.5}
DO
· DO
· ' Waiting for activation of start button
· LOOP UNTIL IN3 = 1
' Check if there is a car in Lane 1 - prox sensor
IF (IN11=1) THEN
· ' Authorize Lane 1 lights to sequence
· HIGH 13
ELSE
· ' Prevent Lane 1 lights from Lighting if no car in lane 1
· LOW 13
ENDIF
' Check if there is a car in Lane 2 - prox sensor
IF (IN10=1) THEN
··· ' Authorize Lane 2 lights to sequence
· HIGH 12
ELSE
· ' Prevent Lane 2 lights from Lighting if no car in lane 2
· LOW 12
ENDIF
' Check if there is a car in Lane 3 - prox sensor
IF (IN2=1) THEN
··· ' Authorize Lane 3 lights to sequence
· HIGH 6
ELSE
··· ' Prevent Lane 3 lights from Lighting if no car in lane 3
· LOW 6
ENDIF
' Check if there is a car in Lane 4 - prox sensor
IF (IN1=1) THEN
··· ' Authorize Lane 4 lights to sequence
· HIGH 5
ELSE
··· ' Prevent Lane 4 lights from Lighting if no car in lane 4
· LOW 5
ENDIF
' Christmas Tree Sequence
PAUSE 500
' First Orange Series Lights and tone
HIGH 15
FREQOUT 9,250,1318
PAUSE 500
' Second Orange Series Lights and tone
HIGH 14
FREQOUT 9, 250,1318
PAUSE 500
' Third Orange Series Lights and tone
HIGH 8
FREQOUT 9, 250,1318
PAUSE 500
' Green GO Series Lights, tone, and starting solenoid
HIGH 7
HIGH 4
FREQOUT 9, 1000, 2793
PAUSE 4000
' 4 second race time then begin returning lights and solenoid to off/home·position
' Staggered lights returning to off position to prevent surges
LOW 7
PAUSE 400
LOW 8
PAUSE 400
LOW 14
PAUSE 400
LOW 15
PAUSE 400
LOW 13
PAUSE 100
LOW 12
PAUSE 100
LOW 6
PAUSE 100
LOW 5
PAUSE 100
LOW 4
PAUSE 500
' Signal to notify that system is returned to ready state for next race.
FREQOUT 9,250,1158
LOOP
END
Thanks in advance for any assistance or directions given.
Sincerely
Cub Scout Pack 529 Future Engineers