I am creating a model railway crossing using a 20m2, but the LED's act strangely. I have a circuit that correctly receives data and pin b.0 can push 2 led's, but when I tried the same on b.1, it can only push one led. If I try to run 2 on b.1, it ignores the first LED, even though the 2 led's should be getting the same power. The LED's are in parallel, so it should run both. The only way to stop this is to have 2 led's on b.0, 1 on b.1 and one on b.2.
Please refer to my earlier thread, " picaxe 20m2 can't read more than 2 LDR's".
I am using 3mm, standard, red LED's
The hardware diagram is included.
I have included the software here:
Hoping someone can help explain what is going on here.
Please refer to my earlier thread, " picaxe 20m2 can't read more than 2 LDR's".
I am using 3mm, standard, red LED's
The hardware diagram is included.
I have included the software here:
Code:
TrainDetect:
b2=0
readadc C.1, b1
readadc C.2, b23
readadc C.3, b24
readadc C.7, b25
if b1<50 then goto LedFlash
if b23<50 then goto LedFlash
if b24<50 then goto LedFlash
if b25<50 then goto LedFlash
goto TrainDetect
LedFlash:
high b.7
high b.1
pause 700
low b.1
high b.0
high b.2
pause 700
low b.0
low b.2
readadc c.1,b1
readadc c.2,b23
readadc c.3,b24
readadc c.7,b25
if b1>50 then goto Timed
if b23>50 then goto Timed
if b24>50 then goto Timed
if b25>50 then goto Timed
goto ledflash
Timed:
high b.1
readadc c.1,b3
readadc c.2,b8
readadc c.3,b13
readadc c.7,b18
pause 700
readadc c.1,b5
readadc c.2,b9
readadc c.3,b14
readadc c.7,b19
low b.1
high b.0
high b.2
pause 700
readadc c.1,b7
readadc c.2,b11
readadc c.3,b16
readadc c.7,b21
low b.0
low b.2
if b3<50 then goto qwerty
if b5<50 then goto qwerty
if b7<50 then goto qwerty
if b8<50 then goto qwerty
if b9<50 then goto qwerty
if b11<50 then goto qwerty
if b13<50 then goto qwerty
if b14<50 then goto qwerty
if b16<50 then goto qwerty
if b18<50 then goto qwerty
if b19<50 then goto qwerty
if b21<50 then goto qwerty
b2=b2+1
if b2<4 then goto Timed
low b.7
goto TrainDetect
qwerty:
b2=0
goto LedFlash
Last edited: