{
  "version": 2,
  "name": "Traffic Light Drum Sequencer - Pedestrian Call",
  "exported": "2026-11-30T00:00:00.000Z",
  "notes": "v1.126+ example for the Traffic Light Intersection scene. Builds on acc-example-traffic-drum.json: the N/S road is the main road and rests on green until a pedestrian asks to cross it. X2 (scene Ped PB E/W, cross N/S road) latches the call C2. Step 1 (NS green) has a 5 s minimum time AND the event C2, so the drum waits there until both are true. When the drum reaches step 4 (EW green) the call has been served and C2 is unlatched. A press during EW yellow or all red is remembered for the next cycle. X3 = Run enable (X tab, maintained). X4 = Reset (X tab): step 1, clears the call and the cycle count. D1 = drum step, D2 = completed cycles, C1 = drum done bit. X1 is not used here (see the challenge in the blog post).",
  "program": [
    {"id": 1, "rn": 0,
     "comment": "EW CALL — a pedestrian at the E/W button (X2) wants to cross the N/S road; latch the call",
     "elements": [
       {"id":101,"kind":"contact","type":"XIC","addr":"X2"},
       {"id":102,"kind":"output","type":"OTL","addr":"C2"}
     ]},
    {"id": 2, "rn": 1,
     "comment": "TRAFFIC SEQUENCE — step 1 (NS green) needs 5 s AND the call C2 before it moves on; every other step is timed only",
     "elements": [
       {"id":103,"kind":"contact","type":"XIC","addr":"X3"},
       {"id":104,"kind":"block","type":"DRUM","addr":"D1","out":"Y1","outs":6,"rst":"X4","dn":"C1","pre":0,
        "steps":[
          {"p":33,"t":5000,"ev":"C2"},
          {"p":34,"t":2000,"ev":""},
          {"p":36,"t":1000,"ev":""},
          {"p":12,"t":5000,"ev":""},
          {"p":20,"t":2000,"ev":""},
          {"p":36,"t":1000,"ev":""}
        ]}
     ]},
    {"id": 3, "rn": 2,
     "comment": "CALL SERVED — once the drum is at step 4 (EW green) clear the call",
     "elements": [
       {"id":105,"kind":"compare","type":"EQU","addr":"D1","cmp":4,"dt":"INT"},
       {"id":106,"kind":"output","type":"OTU","addr":"C2"}
     ]},
    {"id": 4, "rn": 3,
     "comment": "CYCLE COUNT — once per completed cycle (P on the done bit C1) add 1 to D2",
     "elements": [
       {"id":107,"kind":"contact","type":"P","addr":"C1"},
       {"id":108,"kind":"block","type":"INC","addr":"D2","dt":"INT","pre":0}
     ]},
    {"id": 5, "rn": 4,
     "comment": "RESET — X4 clears the cycle count and any waiting call (the drum's own reset input returns it to step 1)",
     "elements": [
       {"id":109,"kind":"contact","type":"XIC","addr":"X4"},
       {"id":110,"kind":"block","type":"MOV","addr":"D2","src":"0","dt":"INT","pre":0},
       {"id":111,"kind":"output","type":"OTU","addr":"C2"}
     ]}
  ],
  "comments": {
    "X2": "Ped PB E/W",
    "X3": "Run Enable Switch",
    "X4": "Reset PB",
    "Y1": "NS Green",
    "Y2": "NS Yellow",
    "Y3": "NS Red",
    "Y4": "EW Green",
    "Y5": "EW Yellow",
    "Y6": "EW Red",
    "C1": "Drum Cycle Done",
    "C2": "EW Call",
    "D1": "Drum Step",
    "D2": "Cycle Count"
  },
  "dregs": {},
  "dfmt": {}
}
