titaniumnitratecoatedcow
Member
i am halfway through making a model parking garage for a school. here is a basic diagram of what it does
View attachment 18687
View attachment 18688
after completing the individual subsystems i have run intp some trouble with adding the fist barrier arm subsystem to the main code. ( when added,the servo arm moves more tan it did on its own)
is
View attachment 18687
View attachment 18688
after completing the individual subsystems i have run intp some trouble with adding the fist barrier arm subsystem to the main code. ( when added,the servo arm moves more tan it did on its own)
is
Code:
#Terminal 4800
Symbol spacesLeft = b0
Symbol spacesShown = b1
Symbol entryBeam = b2
Symbol exitBeam = b3
Symbol ENTRY_ADC = B.4
Symbol EXIT_ADC = C.4
Symbol BROKEN = 10
; Display routine
Start0:
serout B.1,N2400,(254,1)
pause 30
spacesLeft = 4
Pause 500
SerTxd( CR, LF )
SerTxd( "Starting...", CR, LF )
Do
spacesShown = spacesLeft
If spacesShown = 0 Then
SerTxd( "Full - No spaces left", CR, LF )
Else
SerTxd( "Spaces Left = ", #spacesShown, CR, LF )
serout B.1,N2400,(254,128) ; move to start of first line
serout B.1,N2400,("places availible") ; output text
serout b.1, n2400, ( 254, 192 ) 'second line
serout b.1, N2400, (#spacesshown)
End If
Do : Loop Until spacesShown <> spacesLeft
Loop
; Handle the entry beam
Start1:
Do
Do : ReadAdc ENTRY_ADC, entryBeam : Loop Until entryBeam <= BROKEN
Do : ReadAdc ENTRY_ADC, entryBeam : Loop While entryBeam <= BROKEN
spacesLeft = spacesLeft - 1
if spacesleft = 0 then
serout B.1,N2400,(254,1)
serout b.1, n2400, ( 254, 128 ) 'second line
serout b.1, n2400, ( "park is full " )
elseif spacesleft > 0 then goto Start1
End If
'Do : Loop Until spacesShown <> spacesLeft
Loop
; Handle the exit beam
Start2:
Do
Do : ReadAdc EXIT_ADC, exitBeam : Loop Until exitBeam <= BROKEN
Do : ReadAdc EXIT_ADC, exitBeam : Loop While exitBeam <= BROKEN
spacesLeft = spacesLeft + 1 Max 4
Loop
start3:
servo b.3, 80 ;set the initial servo position @ position 137
arm1:
irin b.2,b0
debug
if b0>=20 then up
if b0<20 then down
goto arm1
up:
servopos b.3, 180 ;change the servos position without reseting the timer
pause 500
goto arm1
down:
servopos b.3,80
pause 500
goto arm1