radiogareth
Senior Member
This is some snooker scoreboard code that simulates fine.
However, in hardware the b0 register will not count up past 1, UNLESS the buttion is held down.
The similar colour count section works fine using b1. What are we missing?? - both teacher and pupil are involved here!!
Thanks
Gareth
However, in hardware the b0 register will not count up past 1, UNLESS the buttion is held down.
The similar colour count section works fine using b1. What are we missing?? - both teacher and pupil are involved here!!
Thanks
Gareth
Code:
'Section 0
'if black goes high, make all outputs high
'if red goes high it will add 1 to the red value
' Check the red value.
' if the red value = 15 then send red output high and goto section 1
' if red value is not 15 then go to step 0
'Section 1
'if black goes high, make all outputs high
'if colour input goes high add 1 to colour value
' if colour value = 5
' colour output goes high and goto section 2
'Section 2
'if black goes high, make all outputs high
main:
symbol red = pinb.0
symbol color = pinb.1
symbol black = pinb.2
symbol newgame = pinb.3
let dirsB = %11110000
let dirsC = %10000011
let pin7 = 0
let pin0 = 0
let pin1 = 0
goto seered:
seered:
if newgame = 1 then
goto newgamepress
else if black = 1 then
goto blackpress
else if red = 1 then
goto redpress
else
goto seered
end if
seecolor:
if newgame = 1 then
goto newgamepress
else if black = 1 then
goto blackpress
else if color = 1 then
goto colorpress
else
goto seecolor
end if
seeblack:
if newgame = 1 then
goto newgamepress
else if black = 1 then
goto blackpress
else
goto seeblack
end if
redpress:
pause 700
b0 = b0+1
debug
if b0 = 15 then
let pin7 = 1
goto seecolor
else
goto seered
end if
colorpress:
pause 700
b1 = b1+1
debug
if b1 = 5 then
let pin0 = 1
goto seeblack
else
goto seecolor
end if
blackpress:
pause 700
let pin7 = 1
let pin0 = 1
let pin1 = 1
goto seered
newgamepress:
pause 700
b0 = 0
b1 = 0
debug
let pin7 = 0
let pin0 = 0
let pin1 = 0
goto seered
Last edited by a moderator: