<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>LED &amp;mdash; Paul Sutton</title>
    <link>https://personaljournal.ca/paulsutton/tag:LED</link>
    <description>Personal Blog</description>
    <pubDate>Tue, 05 May 2026 14:57:39 +0000</pubDate>
    <item>
      <title>Code Club Electronics 8</title>
      <link>https://personaljournal.ca/paulsutton/code-club-electronics-8</link>
      <description>&lt;![CDATA[Code Club Electronics 8&#xA;&#xA;So following on from the previous post.  I had to look this up to remind myself how to specific a pin.  Not used Arduino in a while.  I found the following code as part of a stackoverflow post&#xA;&#xA;However, in this, the two LEDs flash on and off alternately. Delay is set by a single line. &#xA;&#xA;int delayPeriod = 1000;&#xA;So this is more so I can learn how to specify a pin. &#xA;&#xA;int ledPin = 12;&#xA;int ledPin2 = 13;&#xA;int delayPeriod = 1000;&#xA;&#xA;void setup()&#xA;{&#xA;  pinMode(ledPin, OUTPUT);&#xA;  pinMode(ledPin2, OUTPUT);&#xA;}&#xA;&#xA;void loop()&#xA;{&#xA;  digitalWrite(ledPin, HIGH);&#xA;  digitalWrite(ledPin2,LOW);&#xA;  delay(delayPeriod);&#xA;  digitalWrite(ledPin2, HIGH);&#xA;  digitalWrite(ledPin,LOW);&#xA;  delay(delayPeriod);&#xA;  //delayPeriod = delayPeriod - 10;&#xA;}&#xA;&#xA;iframe title=&#34;Arduino - blink 2 LEDs&#34; width=&#34;560&#34; height=&#34;315&#34; src=&#34;https://diode.zone/videos/embed/6995f8d6-e8dc-47d3-91c8-63529fa8991d&#34; frameborder=&#34;0&#34; allowfullscreen=&#34;&#34; sandbox=&#34;allow-same-origin allow-scripts allow-popups&#34;/iframe&#xA;&#xA;In the video, I am just changing a single line of code to cause the delay. &#xA;&#xA;Timings are in milliseconds or seconds&#xA;&#xA;Links&#xA;&#xA;Easy module shield&#xA;&#xA;Tags&#xA;&#xA;#Electronics,#Code,#Arduino,#Hacking.#LED,#Blink&#xA;&#xA;hr&#xD;&#xA;&#xD;&#xA;table&#xD;&#xA;thead&#xD;&#xA;trtda rel=&#34;me&#34; href=&#34;https://qoto.org/@zleap&#34;Mastodon/a/td&#xD;&#xA;tda href=&#34;https://wiki.ircnow.org/?n=Shelllabs.Intro&#34;ShellLabs/td&#xD;&#xA;tda href=&#34;https://joinmastodon.org/&#34;Join Mastodon/a/td/tr/thead/table&#xD;&#xA;center&#xD;&#xA;AI statement : b Consent is NOT granted to use the content of this blog for the purposes of AI training or similar activity.  Consent CANNOT be assumed, it has to be granted. /b&#xD;&#xA;/center&#xD;&#xA;&#xD;&#xA;a href=&#34;https://liberapay.com/PaulSutton/donate&#34;img alt=&#34;Donate using Liberapay&#34; src=&#34;https://liberapay.com/assets/widgets/donate.svg&#34;/a&#xD;&#xA;]]&gt;</description>
      <content:encoded><![CDATA[<p>Code Club Electronics 8</p>

<p>So following on from the previous post.  I had to look this up to remind myself how to specific a pin.  Not used Arduino in a while.  I found the following code as part of a <a href="https://arduino.stackexchange.com/questions/13868/sending-blink-to-pin-12-is-causing-on-board-led-to-blink" rel="nofollow">stackoverflow post</a></p>

<p>However, in this, the two LEDs flash on and off alternately. Delay is set by a single line.</p>

<pre><code>int delayPeriod = 1000;
</code></pre>

<p>So this is more so I can learn how to specify a pin.</p>

<pre><code>int ledPin = 12;
int ledPin2 = 13;
int delayPeriod = 1000;

void setup()
{
  pinMode(ledPin, OUTPUT);
  pinMode(ledPin2, OUTPUT);
}

void loop()
{
  digitalWrite(ledPin, HIGH);
  digitalWrite(ledPin2,LOW);
  delay(delayPeriod);
  digitalWrite(ledPin2, HIGH);
  digitalWrite(ledPin,LOW);
  delay(delayPeriod);
  //delayPeriod = delayPeriod - 10;
}
</code></pre>

<iframe title="Arduino - blink 2 LEDs" width="560" height="315" src="https://diode.zone/videos/embed/6995f8d6-e8dc-47d3-91c8-63529fa8991d" frameborder="0" allowfullscreen=""></iframe>

<p>In the video, I am just changing a single line of code to cause the delay.</p>

<p>Timings are in milliseconds or seconds</p>

<p><strong>Links</strong></p>
<ul><li><a href="http://www.getmicros.net/a-look-at-the-easy-module-shield-for-arduino.php" rel="nofollow">Easy module shield</a></li></ul>

<p><strong>Tags</strong></p>

<p><a href="/paulsutton/tag:Electronics" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Electronics</span></a>,<a href="/paulsutton/tag:Code" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Code</span></a>,<a href="/paulsutton/tag:Arduino" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Arduino</span></a>,<a href="/paulsutton/tag:Hacking" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Hacking</span></a>.<a href="/paulsutton/tag:LED" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">LED</span></a>,<a href="/paulsutton/tag:Blink" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Blink</span></a></p>

<hr>

<p><table>
<thead>
<tr><td><a href="https://qoto.org/@zleap" rel="nofollow">Mastodon</a></td>
<td><a href="https://wiki.ircnow.org/?n=Shelllabs.Intro" rel="nofollow">ShellLabs</td>
<td><a href="https://joinmastodon.org/" rel="nofollow">Join Mastodon</a></td></tr></thead></table>

AI statement : <b> Consent is NOT granted to use the content of this blog for the purposes of AI training or similar activity.  Consent CANNOT be assumed, it has to be granted. </b>
</p>

<p><a href="https://liberapay.com/PaulSutton/donate" rel="nofollow"><img alt="Donate using Liberapay" src="https://liberapay.com/assets/widgets/donate.svg"></a></p>
]]></content:encoded>
      <guid>https://personaljournal.ca/paulsutton/code-club-electronics-8</guid>
      <pubDate>Sat, 16 Dec 2023 20:55:06 +0000</pubDate>
    </item>
    <item>
      <title>Code Club Electronics 7</title>
      <link>https://personaljournal.ca/paulsutton/code-club-electronics-7</link>
      <description>&lt;![CDATA[Code Club Electronics 7&#xA;&#xA;Just having a look at an Arduino add-on board, that has various inputs and outputs built in.  The following code (from the default IDE library) flashes an LED on and off.  The delays can be changed within the code. &#xA;&#xA;/&#xA;  Blink&#xA;&#xA;  Turns an LED on for one second, then off for one second, repeatedly.&#xA;&#xA;  Most Arduinos have an on-board LED you can control. On the UNO, MEGA and ZERO&#xA;  it is attached to digital pin 13, on MKR1000 on pin 6. LEDBUILTIN is set to&#xA;  the correct LED pin independent of which board is used.&#xA;  If you want to know what pin the on-board LED is connected to on your Arduino&#xA;  model, check the Technical Specs of your board at:&#xA;  https://www.arduino.cc/en/Main/Products&#xA;&#xA;  modified 8 May 2014&#xA;  by Scott Fitzgerald&#xA;  modified 2 Sep 2016&#xA;  by Arturo Guadalupi&#xA;  modified 8 Sep 2016&#xA;  by Colby Newman&#xA;&#xA;  This example code is in the public domain.&#xA;&#xA;  https://www.arduino.cc/en/Tutorial/BuiltInExamples/Blink&#xA;/&#xA;&#xA;// the setup function runs once when you press reset or power the board&#xA;void setup() {&#xA;  // initialize digital pin LEDBUILTIN as an output.&#xA;  pinMode(LEDBUILTIN, OUTPUT);&#xA;}&#xA;&#xA;// the loop function runs over and over again forever&#xA;void loop() {&#xA;  digitalWrite(LEDBUILTIN, HIGH);   // turn the LED on (HIGH is the voltage level)&#xA;  delay(100);                       // wait for 100 milli seconds&#xA;  digitalWrite(LED_BUILTIN, LOW);    // turn the LED off by making the voltage LOW&#xA;  delay(100);                       // wait for 250 milli seconds&#xA;}&#xA;&#xA;The video just shows the last section of code and what happens when the delay is changed.&#xA;&#xA;iframe title=&#34;Arduino Uno Light Blink&#34; width=&#34;560&#34; height=&#34;315&#34; src=&#34;https://diode.zone/videos/embed/634f3a8c-d12a-4290-ad76-03f881499218&#34; frameborder=&#34;0&#34; allowfullscreen=&#34;&#34; sandbox=&#34;allow-same-origin allow-scripts allow-popups&#34;/iframe&#xA;&#xA;Timings are in milliseconds or seconds&#xA;&#xA;e.g. &#xA;1000 ms = 1 second&#xA;2000 ms = 2 seconds&#xA;100 ms = 0.1 seconds&#xA;250ms = 0.250 seconds (1/4 second)&#xA;500ms = 0.500 seconds (1/2 second)&#xA;&#xA;Links&#xA;&#xA;Easy module shield&#xA;&#xA;Tags&#xA;&#xA;#Electronics,#Code,#Arduino,#Hacking.#LED,#Blink&#xA;&#xA;hr&#xD;&#xA;&#xD;&#xA;table&#xD;&#xA;thead&#xD;&#xA;trtda rel=&#34;me&#34; href=&#34;https://qoto.org/@zleap&#34;Mastodon/a/td&#xD;&#xA;tda href=&#34;https://wiki.ircnow.org/?n=Shelllabs.Intro&#34;ShellLabs/td&#xD;&#xA;tda href=&#34;https://joinmastodon.org/&#34;Join Mastodon/a/td/tr/thead/table&#xD;&#xA;center&#xD;&#xA;AI statement : b Consent is NOT granted to use the content of this blog for the purposes of AI training or similar activity.  Consent CANNOT be assumed, it has to be granted. /b&#xD;&#xA;/center&#xD;&#xA;&#xD;&#xA;a href=&#34;https://liberapay.com/PaulSutton/donate&#34;img alt=&#34;Donate using Liberapay&#34; src=&#34;https://liberapay.com/assets/widgets/donate.svg&#34;/a&#xD;&#xA;]]&gt;</description>
      <content:encoded><![CDATA[<p>Code Club Electronics 7</p>

<p>Just having a look at an Arduino add-on board, that has various inputs and outputs built in.  The following code (from the default IDE library) flashes an LED on and off.  The delays can be changed within the code.</p>

<pre><code>/*
  Blink

  Turns an LED on for one second, then off for one second, repeatedly.

  Most Arduinos have an on-board LED you can control. On the UNO, MEGA and ZERO
  it is attached to digital pin 13, on MKR1000 on pin 6. LED_BUILTIN is set to
  the correct LED pin independent of which board is used.
  If you want to know what pin the on-board LED is connected to on your Arduino
  model, check the Technical Specs of your board at:
  https://www.arduino.cc/en/Main/Products

  modified 8 May 2014
  by Scott Fitzgerald
  modified 2 Sep 2016
  by Arturo Guadalupi
  modified 8 Sep 2016
  by Colby Newman

  This example code is in the public domain.

  https://www.arduino.cc/en/Tutorial/BuiltInExamples/Blink
*/

// the setup function runs once when you press reset or power the board
void setup() {
  // initialize digital pin LED_BUILTIN as an output.
  pinMode(LED_BUILTIN, OUTPUT);
}



// the loop function runs over and over again forever
void loop() {
  digitalWrite(LED_BUILTIN, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(100);                       // wait for 100 milli seconds
  digitalWrite(LED_BUILTIN, LOW);    // turn the LED off by making the voltage LOW
  delay(100);                       // wait for 250 milli seconds
}
</code></pre>

<p>The video just shows the last section of code and what happens when the delay is changed.</p>

<iframe title="Arduino Uno Light Blink" width="560" height="315" src="https://diode.zone/videos/embed/634f3a8c-d12a-4290-ad76-03f881499218" frameborder="0" allowfullscreen=""></iframe>

<p>Timings are in milliseconds or seconds</p>

<p>e.g.
1000 ms = 1 second
2000 ms = 2 seconds
100 ms = 0.1 seconds
250ms = 0.250 seconds (¼ second)
500ms = 0.500 seconds (½ second)</p>

<p><strong>Links</strong></p>
<ul><li><a href="http://www.getmicros.net/a-look-at-the-easy-module-shield-for-arduino.php" rel="nofollow">Easy module shield</a></li></ul>

<p><strong>Tags</strong></p>

<p><a href="/paulsutton/tag:Electronics" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Electronics</span></a>,<a href="/paulsutton/tag:Code" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Code</span></a>,<a href="/paulsutton/tag:Arduino" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Arduino</span></a>,<a href="/paulsutton/tag:Hacking" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Hacking</span></a>.<a href="/paulsutton/tag:LED" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">LED</span></a>,<a href="/paulsutton/tag:Blink" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Blink</span></a></p>

<hr>

<p><table>
<thead>
<tr><td><a href="https://qoto.org/@zleap" rel="nofollow">Mastodon</a></td>
<td><a href="https://wiki.ircnow.org/?n=Shelllabs.Intro" rel="nofollow">ShellLabs</td>
<td><a href="https://joinmastodon.org/" rel="nofollow">Join Mastodon</a></td></tr></thead></table>

AI statement : <b> Consent is NOT granted to use the content of this blog for the purposes of AI training or similar activity.  Consent CANNOT be assumed, it has to be granted. </b>
</p>

<p><a href="https://liberapay.com/PaulSutton/donate" rel="nofollow"><img alt="Donate using Liberapay" src="https://liberapay.com/assets/widgets/donate.svg"></a></p>
]]></content:encoded>
      <guid>https://personaljournal.ca/paulsutton/code-club-electronics-7</guid>
      <pubDate>Sat, 16 Dec 2023 19:56:40 +0000</pubDate>
    </item>
  </channel>
</rss>