IC10 Learning Series

Episode 2: Branching + Sensors

Episode 2 expands your first script into practical base automation: multiple IC housings, proximity door logic, and daylight-based lighting using branching with beq.

Episode Focus

  • Managing multiple IC housings: split responsibilities so each chip stays focused and easier to debug.
  • Proximity sensor -> door: open/close behavior triggered by player presence.
  • Daylight sensor -> lights: auto-toggle lighting based on ambient conditions.
  • beq branching: route execution to labels when a condition is met.

Episode 2 Full Script (Proximity Door and Nighttime lights)

# 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

What the IC10 lines do

Companion Notes