krogerssolar
Senior Member
Hi all I have code for a IR Railroad track side signal indicator control the code below is for two led's and two Ir Receivers I'm Building a switch yard and was wondering if i could have each picaxe say 4 or 5. I would like any of the picaxe's to trigger the red led code on each Pixace so when the Ir is tripped on one picaxe it will trigger on the others until the Ir beam is restored. Is this Idea Possible.
Code:
#PICAXE 14M2
; define the IO pin assignments
SYMBOL GreenLight = b.1
SYMBOL RedLight = b.2
SYMBOL IRIN1 = pinc.3 ; The IR input to detect train presence
SYMBOL IRIN2 = pinc.2 ; The IR input to detect train presence
;Define the variables
SYMBOL flasher = b6 ; used to count number of cycles in yellow/amber flash mode
;Define the constants
SYMBOL Red_Off_Delay = 8000 ; milliseconds
Initialise:
LOW GreenLight ; Green LED on
HIGH RedLight ; Red LED off
MAIN:
DO
IF IRIN1 =1 or IRIN2 =1 THEN ; IR beam is broken
HIGH GreenLight ; Green LED off
LOW RedLight ; Red LED on
Wait_Till_clear:
IF IRIN1 =1 or IRIN2 =1 THEN Wait_Till_clear
PAUSE Red_off_Delay ; wait for the red phase period to end
HIGH RedLight ; Red LED off
LOW GreenLight ; Green LED on
ELSE ; IR beam is received
LOW GreenLight ; Green LED on
HIGH RedLight ; Red LED off
ENDIF
LOOP