{"id":52309,"date":"2026-11-01T10:50:55","date_gmt":"2026-11-01T10:50:55","guid":{"rendered":"http:\/\/siratek.net\/index.php\/tutorials\/pedestrian-crossing\/"},"modified":"2026-11-01T10:50:55","modified_gmt":"2026-11-01T10:50:55","slug":"pedestrian-crossing","status":"publish","type":"siratek_tutorial","link":"https:\/\/siratek.net\/index.php\/tutorials\/pedestrian-crossing\/","title":{"rendered":"Project, a Pedestrian Crossing"},"content":{"rendered":"<body><p><\/p>\n<h2>What you will build<\/h2>\n<p>A working pedestrian crossing. The traffic light sits on green. Press the button and nothing happens for a moment, then amber, then red, a beep while the crossing is clear, and back to green after a sensible pause.<\/p>\n<p>It is the first project in the library and it is deliberately modest. Three parts you already know and no new wiring tricks. What it teaches is <strong>the thing every project after it needs<\/strong>: how to make several components behave as one sequence without <code>delay()<\/code> freezing the button.<\/p>\n<h2>Before you begin<\/h2>\n<h3>Parts<\/h3>\n<table>\n<thead>\n<tr>\n<th>Part<\/th>\n<th>Siratek product<\/th>\n<th>Its own tutorial<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>Arduino Uno<\/td>\n<td>2219<\/td>\n<td><em>Getting Started with Arduino Uno<\/em><\/td>\n<\/tr>\n<tr>\n<td>LED traffic light module<\/td>\n<td>49920<\/td>\n<td><em>LED Traffic Light Module<\/em><\/td>\n<\/tr>\n<tr>\n<td>Tactile push button<\/td>\n<td>49488<\/td>\n<td><em>Read a Push Button<\/em><\/td>\n<\/tr>\n<tr>\n<td>Passive buzzer<\/td>\n<td>8051<\/td>\n<td><em>Play Tones with a Passive Buzzer<\/em><\/td>\n<\/tr>\n<tr>\n<td>Breadboard and jumper wires<\/td>\n<td><\/td>\n<td><em>Using a Breadboard<\/em><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Build each of those three on its own first if you have not. This page assumes all three work separately, and the first stage below checks that assumption rather than trusting it.<\/p>\n<h3>What this project is really teaching<\/h3>\n<p>A crossing is a <strong>state machine<\/strong>. At any moment it is in exactly one of a handful of states, and each state knows what comes next and when.<\/p>\n<p>That sounds grand for a set of lights. It matters because the obvious approach does not work:<\/p>\n<pre><code>\/\/ The obvious version, which cannot work.\nif (buttonPressed()) {\n  digitalWrite(green, LOW);\n  digitalWrite(amber, HIGH);\n  delay(3000);                 \/\/ the button is ignored for three seconds\n  digitalWrite(amber, LOW);\n  digitalWrite(red, HIGH);\n  delay(8000);                 \/\/ and for eight more\n  \/\/ ...\n}<\/code><\/pre>\n<p>During those eleven seconds the sketch is blind. It cannot beep in a pattern, cannot watch the button, cannot do anything. Real crossings do all of that at once.<\/p>\n<p>The state machine solves it with no cleverness: a variable says which state we are in, a timestamp says when we entered it, and <code>loop()<\/code> asks each pass whether it is time to move on. It is the <code>millis()<\/code> pattern from <em>Timing Without delay()<\/em>, applied to a sequence rather than one LED.<\/p>\n<h2>How it works<\/h2>\n<p>Five states, and the rules between them:<\/p>\n<table>\n<thead>\n<tr>\n<th>State<\/th>\n<th>Lights<\/th>\n<th>What ends it<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><code>TRAFFIC_GREEN<\/code><\/td>\n<td>Green<\/td>\n<td>A button press, <strong>and<\/strong> at least 5 s since the last crossing<\/td>\n<\/tr>\n<tr>\n<td><code>TRAFFIC_AMBER<\/code><\/td>\n<td>Amber<\/td>\n<td>3 seconds<\/td>\n<\/tr>\n<tr>\n<td><code>PEDESTRIAN_CROSS<\/code><\/td>\n<td>Red<\/td>\n<td>8 seconds, with the buzzer beeping<\/td>\n<\/tr>\n<tr>\n<td><code>PEDESTRIAN_CLEAR<\/code><\/td>\n<td>Red, buzzer faster<\/td>\n<td>4 seconds<\/td>\n<\/tr>\n<tr>\n<td><code>TRAFFIC_RETURN<\/code><\/td>\n<td>Amber<\/td>\n<td>2 seconds, then back to green<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Two design decisions are worth naming, because they are the difference between a toy and something that behaves properly.<\/p>\n<p><strong>The minimum green time.<\/strong> Without it, holding the button down cycles the crossing continuously and traffic never moves. Five seconds of guaranteed green after a crossing finishes is what a real installation does, and it is one comparison in the code.<\/p>\n<p><strong>The press is remembered, not acted on.<\/strong> Pressing during the red phase does not queue a second crossing. The request is recorded, and it is cleared when the crossing begins.<\/p>\n<figure class=\"siratek-tutorial-figure\"><img decoding=\"async\" src=\"http:\/\/siratek.net\/wp-content\/uploads\/2026\/11\/pedestrian-crossing-states.svg\" alt=\"The five states of the crossing with the transitions between them, showing the button press and minimum green time that leave the green state\" loading=\"lazy\"><figcaption>The minimum green time is what stops a held button blocking traffic for ever.<\/figcaption><\/figure>\n<h2>Build it in stages<\/h2>\n<p>Each stage ends with something you can see. Do not move on until you have seen it.<\/p>\n<h3>Stage 1: prove the three parts<\/h3>\n<p>Wire all three and run this. It does nothing clever; it proves the wiring before any logic exists.<\/p>\n<pre><code>\/\/ Siratek: stage 1. Each part, one at a time.\n\nconst int redPin = 8;\nconst int amberPin = 9;\nconst int greenPin = 10;\nconst int buttonPin = 2;\nconst int buzzerPin = 11;\n\nvoid setup() {\n  pinMode(redPin, OUTPUT);\n  pinMode(amberPin, OUTPUT);\n  pinMode(greenPin, OUTPUT);\n  pinMode(buzzerPin, OUTPUT);\n  pinMode(buttonPin, INPUT_PULLUP);\n\n  Serial.begin(9600);\n  Serial.println(\"Siratek: red, amber, green, beep, then the button.\");\n\n  int pins[] = {redPin, amberPin, greenPin};\n  for (int i = 0; i &lt; 3; i++) {\n    digitalWrite(pins[i], HIGH);\n    delay(600);\n    digitalWrite(pins[i], LOW);\n  }\n\n  tone(buzzerPin, 1000, 300);\n}\n\nvoid loop() {\n  Serial.println(digitalRead(buttonPin) == LOW ? \"pressed\" : \"up\");\n  delay(300);\n}<\/code><\/pre>\n<p>Each light in turn, one beep, then the button state printed. If any of those is wrong, fix it now: it will be far harder to find once there is a state machine on top.<\/p>\n<h3>Stage 2: the sequence, without the button<\/h3>\n<p>Replace <code>loop()<\/code> with a sequence that runs on a timer, so you can watch the timings and adjust them before the button complicates things.<\/p>\n<pre><code>\/\/ Siratek: stage 2. The sequence, triggered every 15 seconds.\n\nenum State { TRAFFIC_GREEN, TRAFFIC_AMBER, PEDESTRIAN_CROSS, PEDESTRIAN_CLEAR, TRAFFIC_RETURN };\n\nState state = TRAFFIC_GREEN;\nunsigned long stateSince = 0;\n\nvoid enter(State next) {\n  state = next;\n  stateSince = millis();\n\n  digitalWrite(redPin, state == PEDESTRIAN_CROSS || state == PEDESTRIAN_CLEAR);\n  digitalWrite(amberPin, state == TRAFFIC_AMBER || state == TRAFFIC_RETURN);\n  digitalWrite(greenPin, state == TRAFFIC_GREEN);\n}\n\nunsigned long elapsed() {\n  return millis() - stateSince;\n}\n\nvoid loop() {\n  switch (state) {\n    case TRAFFIC_GREEN:\n      if (elapsed() &gt;= 15000) enter(TRAFFIC_AMBER);\n      break;\n    case TRAFFIC_AMBER:\n      if (elapsed() &gt;= 3000) enter(PEDESTRIAN_CROSS);\n      break;\n    case PEDESTRIAN_CROSS:\n      if (elapsed() &gt;= 8000) enter(PEDESTRIAN_CLEAR);\n      break;\n    case PEDESTRIAN_CLEAR:\n      if (elapsed() &gt;= 4000) enter(TRAFFIC_RETURN);\n      break;\n    case TRAFFIC_RETURN:\n      if (elapsed() &gt;= 2000) enter(TRAFFIC_GREEN);\n      break;\n  }\n}<\/code><\/pre>\n<p>Watch a full cycle. Adjust the numbers until the rhythm feels right. Notice that <code>enter()<\/code> sets all three lights from the state, so no state can accidentally leave a light on: that is worth more than it looks.<\/p>\n<h3>Stage 3: the button and the buzzer<\/h3>\n<p>Now add the request, the minimum green time, and the beeping. That is the complete sketch below.<\/p>\n<h2>The complete sketch<\/h2>\n<pre><code>\/\/ Siratek: a pedestrian crossing.\n\/\/ Traffic runs on green until someone asks to cross.\n\nconst int redPin = 8;\nconst int amberPin = 9;\nconst int greenPin = 10;\nconst int buttonPin = 2;\nconst int buzzerPin = 11;\n\n\/\/ Timings, in milliseconds. Adjust to taste.\nconst unsigned long AMBER_TIME    = 3000;\nconst unsigned long CROSS_TIME    = 8000;\nconst unsigned long CLEAR_TIME    = 4000;\nconst unsigned long RETURN_TIME   = 2000;\nconst unsigned long MINIMUM_GREEN = 5000;   \/\/ traffic gets at least this long\n\n\/\/ Beep rates: slow while crossing, urgent while clearing.\nconst unsigned long CROSS_BEEP = 700;\nconst unsigned long CLEAR_BEEP = 220;\n\nenum State { TRAFFIC_GREEN, TRAFFIC_AMBER, PEDESTRIAN_CROSS, PEDESTRIAN_CLEAR, TRAFFIC_RETURN };\n\nState state = TRAFFIC_GREEN;\nunsigned long stateSince = 0;\n\nbool requested = false;\n\n\/\/ Button debouncing, as in Making a Button Behave.\nint lastReading = HIGH;\nunsigned long lastChange = 0;\nconst unsigned long DEBOUNCE = 40;\n\nunsigned long lastBeep = 0;\n\nvoid enter(State next) {\n  state = next;\n  stateSince = millis();\n\n  digitalWrite(redPin,   state == PEDESTRIAN_CROSS || state == PEDESTRIAN_CLEAR);\n  digitalWrite(amberPin, state == TRAFFIC_AMBER    || state == TRAFFIC_RETURN);\n  digitalWrite(greenPin, state == TRAFFIC_GREEN);\n\n  noTone(buzzerPin);\n\n  Serial.print(\"state: \");\n  switch (state) {\n    case TRAFFIC_GREEN:     Serial.println(\"traffic green\"); break;\n    case TRAFFIC_AMBER:     Serial.println(\"amber\"); break;\n    case PEDESTRIAN_CROSS:  Serial.println(\"cross\"); break;\n    case PEDESTRIAN_CLEAR:  Serial.println(\"clearing\"); break;\n    case TRAFFIC_RETURN:    Serial.println(\"returning\"); break;\n  }\n}\n\nunsigned long elapsed() {\n  return millis() - stateSince;\n}\n\nvoid readButton() {\n  int reading = digitalRead(buttonPin);\n\n  if (reading != lastReading) {\n    lastChange = millis();\n    lastReading = reading;\n    return;\n  }\n\n  \/\/ Act on a settled press, once.\n  if (millis() - lastChange &gt; DEBOUNCE &amp;&amp; reading == LOW &amp;&amp; !requested) {\n    requested = true;\n    Serial.println(\"  request noted\");\n  }\n}\n\nvoid beepEvery(unsigned long interval) {\n  if (millis() - lastBeep &gt;= interval) {\n    lastBeep = millis();\n    tone(buzzerPin, 1800, 80);\n  }\n}\n\nvoid setup() {\n  pinMode(redPin, OUTPUT);\n  pinMode(amberPin, OUTPUT);\n  pinMode(greenPin, OUTPUT);\n  pinMode(buzzerPin, OUTPUT);\n  pinMode(buttonPin, INPUT_PULLUP);\n\n  Serial.begin(9600);\n  Serial.println(\"Siratek: pedestrian crossing.\");\n\n  enter(TRAFFIC_GREEN);\n}\n\nvoid loop() {\n  readButton();            \/\/ every pass, whatever state we are in\n\n  switch (state) {\n    case TRAFFIC_GREEN:\n      \/\/ Honour the request, but not before traffic has had its minimum.\n      if (requested &amp;&amp; elapsed() &gt;= MINIMUM_GREEN) {\n        enter(TRAFFIC_AMBER);\n      }\n      break;\n\n    case TRAFFIC_AMBER:\n      if (elapsed() &gt;= AMBER_TIME) {\n        requested = false;          \/\/ the request has been granted\n        enter(PEDESTRIAN_CROSS);\n      }\n      break;\n\n    case PEDESTRIAN_CROSS:\n      beepEvery(CROSS_BEEP);\n      if (elapsed() &gt;= CROSS_TIME) {\n        enter(PEDESTRIAN_CLEAR);\n      }\n      break;\n\n    case PEDESTRIAN_CLEAR:\n      beepEvery(CLEAR_BEEP);\n      if (elapsed() &gt;= CLEAR_TIME) {\n        enter(TRAFFIC_RETURN);\n      }\n      break;\n\n    case TRAFFIC_RETURN:\n      if (elapsed() &gt;= RETURN_TIME) {\n        enter(TRAFFIC_GREEN);\n      }\n      break;\n  }\n}<\/code><\/pre>\n<h3>Why <code>readButton()<\/code> is called first, every pass<\/h3>\n<p>Because the button must work in every state, not only on green. Pressing during the crossing should be noticed and simply have no effect, rather than being missed entirely.<\/p>\n<p>That is also why the request is cleared when the crossing <strong>starts<\/strong>, not when the button is read. A press during the amber phase is part of the crossing already under way; a press during the crossing itself sets the flag again and will be honoured next time.<\/p>\n<h3>Why <code>tone()<\/code> and not <code>digitalWrite()<\/code><\/h3>\n<p>A passive buzzer needs a changing signal, and <code>tone()<\/code> with a duration is non-blocking: it starts the note and returns immediately. <code>beepEvery()<\/code> therefore costs nothing in the loop.<\/p>\n<p>Remember that <code>tone()<\/code> uses Timer2, so <strong>PWM on pins 3 and 11 is unavailable<\/strong>. Pin 11 is the buzzer here, which is fine, but it is why the lights are on 8, 9 and 10.<\/p>\n<h2>Testing it<\/h2>\n<p>Work through these deliberately. Each one checks a decision rather than the wiring.<\/p>\n<table>\n<thead>\n<tr>\n<th>Try this<\/th>\n<th>It should<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>Leave it alone<\/td>\n<td>Stay on green indefinitely<\/td>\n<\/tr>\n<tr>\n<td>Press once<\/td>\n<td>Amber, then red with beeping, then back to green<\/td>\n<\/tr>\n<tr>\n<td>Press, then press again during red<\/td>\n<td>Nothing extra; one crossing<\/td>\n<\/tr>\n<tr>\n<td>Press immediately after a crossing ends<\/td>\n<td>Wait for the minimum green, then go<\/td>\n<\/tr>\n<tr>\n<td>Hold the button down<\/td>\n<td>One crossing per minimum-green period, not continuous<\/td>\n<\/tr>\n<tr>\n<td>Press during amber<\/td>\n<td>No effect; the crossing is already starting<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>The fifth is the one that catches a careless implementation, and the one a real crossing has to get right.<\/p>\n<h2>Making it yours<\/h2>\n<ul>\n<li><strong>A waiting light.<\/strong> A fourth LED lit from the moment the request is noted until the crossing begins. That is what tells a person their press registered, and it is one <code>digitalWrite()<\/code> in <code>readButton()<\/code> and one in <code>enter()<\/code>.<\/li>\n<li><strong>A night mode.<\/strong> Add an LDR, and after dark make the amber flash rather than running the full sequence. <em>Measuring Light with an LDR<\/em> has the threshold work.<\/li>\n<li><strong>Two directions.<\/strong> A second light module for the other road, red when the first is green. The state machine barely changes; <code>enter()<\/code> sets six pins instead of three.<\/li>\n<li><strong>A countdown.<\/strong> A 7-segment display showing the seconds left to cross. <em>Driving a 4-Digit 7-Segment Display<\/em> covers the multiplexing, and the number comes from <code>CROSS_TIME - elapsed()<\/code>.<\/li>\n<\/ul>\n<h2>Troubleshooting<\/h2>\n<table>\n<thead>\n<tr>\n<th>Symptom<\/th>\n<th>Likely cause<\/th>\n<th>Check or fix<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>A light stays on in the wrong state<\/td>\n<td>Set outside <code>enter()<\/code><\/td>\n<td>All three are set there, from the state<\/td>\n<\/tr>\n<tr>\n<td>Button does nothing<\/td>\n<td>Not <code>INPUT_PULLUP<\/code>, or wrong pin<\/td>\n<td>Stage 1 checks this<\/td>\n<\/tr>\n<tr>\n<td>One press causes several crossings<\/td>\n<td>Not debounced, or the flag not cleared<\/td>\n<td>Clear <code>requested<\/code> when the crossing starts<\/td>\n<\/tr>\n<tr>\n<td>Holding the button blocks traffic<\/td>\n<td>No minimum green<\/td>\n<td>That comparison is the fix<\/td>\n<\/tr>\n<tr>\n<td>Buzzer silent<\/td>\n<td>Active buzzer, not passive<\/td>\n<td><code>tone()<\/code> needs a passive one<\/td>\n<\/tr>\n<tr>\n<td>Buzzer sounds but an LED stopped dimming<\/td>\n<td><code>tone()<\/code> has taken Timer2<\/td>\n<td>Pins 3 and 11 lose PWM<\/td>\n<\/tr>\n<tr>\n<td>Beeping is irregular<\/td>\n<td><code>delay()<\/code> crept back in<\/td>\n<td>Nothing in <code>loop()<\/code> may block<\/td>\n<\/tr>\n<tr>\n<td>Sequence drifts over hours<\/td>\n<td>Comparing <code>millis()<\/code> wrongly<\/td>\n<td>Always subtract, as <code>elapsed()<\/code> does<\/td>\n<\/tr>\n<tr>\n<td>Lights dim<\/td>\n<td>All three on at once, or no resistors<\/td>\n<td>The module has its own; check the module tutorial<\/td>\n<\/tr>\n<tr>\n<td>Works, then stops after seven weeks<\/td>\n<td><code>millis()<\/code> rollover<\/td>\n<td>Subtraction survives it; comparison does not<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2>Sources and attribution<\/h2>\n<p>All text, wiring guidance and code in this project are original Siratek work.<\/p>\n<ul>\n<li>The component behaviour is as described in <em>LED Traffic Light Module<\/em>, <em>Read a Push Button<\/em> and <em>Play Tones with a Passive Buzzer<\/em>, including the module\u2019s onboard current-limiting resistors and the <code>tone()<\/code> timer conflict.<\/li>\n<\/ul>\n<p>The state machine and the timings here are a teaching arrangement, not a specification for a real road crossing, which is a regulated installation with requirements this project does not attempt to meet. No third-party tutorial text, diagrams, photographs or code has been reproduced here.<\/p>\n<p><\/p>\n<\/body>","protected":false},"excerpt":{"rendered":"<p>A working pedestrian crossing. The traffic light sits on green. Press the button and nothing happens for a moment, then amber, then red, a beep while the crossing is clear, and back to green after a sensible pause.<\/p>\n","protected":false},"featured_media":0,"template":"","siratek_tutorial_level":[],"class_list":["post-52309","siratek_tutorial","type-siratek_tutorial","status-publish","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Project, a Pedestrian Crossing - siratek<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"http:\/\/siratek.net\/index.php\/tutorials\/pedestrian-crossing\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Project, a Pedestrian Crossing - siratek\" \/>\n<meta property=\"og:description\" content=\"A working pedestrian crossing. The traffic light sits on green. Press the button and nothing happens for a moment, then amber, then red, a beep while the crossing is clear, and back to green after a sensible pause.\" \/>\n<meta property=\"og:url\" content=\"http:\/\/siratek.net\/index.php\/tutorials\/pedestrian-crossing\/\" \/>\n<meta property=\"og:site_name\" content=\"siratek\" \/>\n<meta property=\"og:image\" content=\"http:\/\/siratek.net\/wp-content\/uploads\/2026\/11\/pedestrian-crossing-states.svg\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"9 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"http:\\\/\\\/siratek.net\\\/index.php\\\/tutorials\\\/pedestrian-crossing\\\/\",\"url\":\"http:\\\/\\\/siratek.net\\\/index.php\\\/tutorials\\\/pedestrian-crossing\\\/\",\"name\":\"Project, a Pedestrian Crossing - siratek\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/siratek.net\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"http:\\\/\\\/siratek.net\\\/index.php\\\/tutorials\\\/pedestrian-crossing\\\/#primaryimage\"},\"image\":{\"@id\":\"http:\\\/\\\/siratek.net\\\/index.php\\\/tutorials\\\/pedestrian-crossing\\\/#primaryimage\"},\"thumbnailUrl\":\"http:\\\/\\\/siratek.net\\\/wp-content\\\/uploads\\\/2026\\\/11\\\/pedestrian-crossing-states.svg\",\"datePublished\":\"2026-11-01T10:50:55+00:00\",\"breadcrumb\":{\"@id\":\"http:\\\/\\\/siratek.net\\\/index.php\\\/tutorials\\\/pedestrian-crossing\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"http:\\\/\\\/siratek.net\\\/index.php\\\/tutorials\\\/pedestrian-crossing\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"http:\\\/\\\/siratek.net\\\/index.php\\\/tutorials\\\/pedestrian-crossing\\\/#primaryimage\",\"url\":\"https:\\\/\\\/siratek.net\\\/wp-content\\\/uploads\\\/2026\\\/11\\\/pedestrian-crossing-states.svg\",\"contentUrl\":\"https:\\\/\\\/siratek.net\\\/wp-content\\\/uploads\\\/2026\\\/11\\\/pedestrian-crossing-states.svg\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"http:\\\/\\\/siratek.net\\\/index.php\\\/tutorials\\\/pedestrian-crossing\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/siratek.net\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Tutorials\",\"item\":\"https:\\\/\\\/siratek.net\\\/index.php\\\/tutorials\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Project, a Pedestrian Crossing\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/siratek.net\\\/#website\",\"url\":\"https:\\\/\\\/siratek.net\\\/\",\"name\":\"siratek\",\"description\":\"Your Best Electronic Retail Shop\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/siratek.net\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Project, a Pedestrian Crossing - siratek","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"http:\/\/siratek.net\/index.php\/tutorials\/pedestrian-crossing\/","og_locale":"en_US","og_type":"article","og_title":"Project, a Pedestrian Crossing - siratek","og_description":"A working pedestrian crossing. The traffic light sits on green. Press the button and nothing happens for a moment, then amber, then red, a beep while the crossing is clear, and back to green after a sensible pause.","og_url":"http:\/\/siratek.net\/index.php\/tutorials\/pedestrian-crossing\/","og_site_name":"siratek","og_image":[{"url":"http:\/\/siratek.net\/wp-content\/uploads\/2026\/11\/pedestrian-crossing-states.svg","type":"","width":"","height":""}],"twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"9 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"http:\/\/siratek.net\/index.php\/tutorials\/pedestrian-crossing\/","url":"http:\/\/siratek.net\/index.php\/tutorials\/pedestrian-crossing\/","name":"Project, a Pedestrian Crossing - siratek","isPartOf":{"@id":"https:\/\/siratek.net\/#website"},"primaryImageOfPage":{"@id":"http:\/\/siratek.net\/index.php\/tutorials\/pedestrian-crossing\/#primaryimage"},"image":{"@id":"http:\/\/siratek.net\/index.php\/tutorials\/pedestrian-crossing\/#primaryimage"},"thumbnailUrl":"http:\/\/siratek.net\/wp-content\/uploads\/2026\/11\/pedestrian-crossing-states.svg","datePublished":"2026-11-01T10:50:55+00:00","breadcrumb":{"@id":"http:\/\/siratek.net\/index.php\/tutorials\/pedestrian-crossing\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["http:\/\/siratek.net\/index.php\/tutorials\/pedestrian-crossing\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"http:\/\/siratek.net\/index.php\/tutorials\/pedestrian-crossing\/#primaryimage","url":"https:\/\/siratek.net\/wp-content\/uploads\/2026\/11\/pedestrian-crossing-states.svg","contentUrl":"https:\/\/siratek.net\/wp-content\/uploads\/2026\/11\/pedestrian-crossing-states.svg"},{"@type":"BreadcrumbList","@id":"http:\/\/siratek.net\/index.php\/tutorials\/pedestrian-crossing\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/siratek.net\/"},{"@type":"ListItem","position":2,"name":"Tutorials","item":"https:\/\/siratek.net\/index.php\/tutorials\/"},{"@type":"ListItem","position":3,"name":"Project, a Pedestrian Crossing"}]},{"@type":"WebSite","@id":"https:\/\/siratek.net\/#website","url":"https:\/\/siratek.net\/","name":"siratek","description":"Your Best Electronic Retail Shop","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/siratek.net\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/siratek.net\/index.php\/wp-json\/wp\/v2\/siratek_tutorial\/52309","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/siratek.net\/index.php\/wp-json\/wp\/v2\/siratek_tutorial"}],"about":[{"href":"https:\/\/siratek.net\/index.php\/wp-json\/wp\/v2\/types\/siratek_tutorial"}],"version-history":[{"count":0,"href":"https:\/\/siratek.net\/index.php\/wp-json\/wp\/v2\/siratek_tutorial\/52309\/revisions"}],"wp:attachment":[{"href":"https:\/\/siratek.net\/index.php\/wp-json\/wp\/v2\/media?parent=52309"}],"wp:term":[{"taxonomy":"siratek_tutorial_level","embeddable":true,"href":"https:\/\/siratek.net\/index.php\/wp-json\/wp\/v2\/siratek_tutorial_level?post=52309"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}