Episode Video
This episode demonstrates how branching logic unlocks more useful automation patterns.
Watch Episode 2 on YouTube
IC10 Learning Series
Episode 2 expands your first script into practical base automation: multiple IC housings, proximity door logic, and daylight-based lighting using branching with beq.
This episode demonstrates how branching logic unlocks more useful automation patterns.
Watch Episode 2 on YouTube
beq branching: route execution to labels when a condition is met.# Define Devices - d0 -> d5 # Blast Door alias door d0 # Occupancy Sensor alias proximity d1 # Light alias light d2 # Daylight Sensor alias daylight d3 # Define Variables - r0 -> r15 alias isOccupied r0 alias isDaytime r1 # Main Loop Start: # Read the occupancy sensor l isOccupied proximity Activate # Write the value to the door s door Open isOccupied # Read the daylight sensor l isDaytime daylight Activate # If isDaytime equal to 0, jump to NightTime beq isDaytime 0 NightTime # If isDaytime equal to 1, jump to DayTime beq isDaytime 1 DayTime j Start NightTime: # If night time, turn light on s light On 1 j Start DayTime: # If day, turn light off s light On 0 j Start
l isOccupied proximity Activate
Reads the proximity sensor's Activate value into isOccupied. This is your occupancy input for the door logic.
s door Open isOccupied
Writes the occupancy value directly to the door Open setting. Occupied means open, empty means closed.
beq isDaytime 0 NightTime
beq means branch-if-equal. If isDaytime equals 0, execution jumps to NightTime.
beq isDaytime 1 DayTime
Second branch path. If isDaytime equals 1, execution jumps to DayTime.
s light On 1 / s light On 0
Night branch writes 1 to turn lights on; day branch writes 0 to turn lights off.
j Start
Loops back to the start so sensors and outputs update continuously.