<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.element14.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>Arduino Starter Kit: Spaceship Interference -- The Learning Circuit 12</title><link>https://community.element14.com/challenges-projects/element14-presents/thelearningcircuit/w/documents/3648/arduino-starter-kit-spaceship-interference----the-learning-circuit-12</link><description /><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>Arduino Starter Kit: Spaceship Interference -- The Learning Circuit 12</title><link>https://community.element14.com/challenges-projects/element14-presents/thelearningcircuit/w/documents/3648/arduino-starter-kit-spaceship-interference----the-learning-circuit-12</link><pubDate>Wed, 23 May 2018 07:24:00 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:3953e376-f05d-45bc-a0ec-2f850146c917</guid><dc:creator>Matt</dc:creator><comments>https://community.element14.com/challenges-projects/element14-presents/thelearningcircuit/w/documents/3648/arduino-starter-kit-spaceship-interference----the-learning-circuit-12#comments</comments><description>Current Revision posted to Documents by Matt on 5/23/2018 7:24:00 AM&lt;br /&gt;
&lt;table cellpadding="0" cellspacing="0" style="padding:0px;margin:0px;background-color:#c4e3ed;width:100%;"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td rowspan="3" style="padding-top:10px;padding-left:8px;vertical-align:top;"&gt;&lt;a href="/e14/assets/legacy/2017/BHlearningCir.png" data-e14adj="t"&gt;&lt;img alt="image" class="nolightbox" src="/e14/assets/legacy/2017/BHlearningCir.png"  /&gt;&lt;/a&gt;&lt;/td&gt;&lt;td rowspan="3" style="vertical-align:top;padding:10px 13px 13px 8px;"&gt;&lt;p style="margin:0;font-size:18px;line-height:18px;font-weight:bold;padding-bottom:6px;"&gt;&lt;a class="jivecontainerTT-hover-container jive-link-community-small" href="/challengesprojects/element14-presents/benheck/" data-e14adj="t"&gt;element14&amp;#39;s The Ben Heck Show&lt;/a&gt;&lt;/p&gt;&lt;p style="margin:0;padding-bottom:6px;line-height:18px;"&gt;Join Karen as she shares her enthusiasm for teaching STEM subjects, gives you what you need to know to get started on electronics projects, and more.&lt;/p&gt;&lt;p style="margin:0;"&gt;&lt;a href="/challengesprojects/element14-presents/benheck/" data-e14adj="t"&gt;Back to The Ben Heck Show homepage &lt;img loading="lazy" alt="image" src="/e14/assets/legacy/gen/LinkArrow.gif"  /&gt;&lt;/a&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="padding:8px 10px;background-color:#004156;vertical-align:middle;" width="30%"&gt;&lt;a class="" href="https://www.element14.com/community/community/experts/benheck/thelearningcircuit?ICID=TLC-episodedoc-topban" target="_blank" data-e14adj="t"&gt;&lt;span style="color:#ffffff;text-decoration:none;"&gt;The Learning Circuit&lt;/span&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style="padding:8px 10px;background-color:#005973;vertical-align:middle;"&gt;&lt;a class="jivecontainerTT-hover-container jive-link-community-small" href="/challengesprojects/element14-presents/benheck/ben-heck-exclusive/" data-e14adj="t"&gt;&lt;span style="color:#ffffff;text-decoration:none;"&gt;Featured Bonus Content&lt;/span&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style="padding:8px 10px;background-color:#006f91;vertical-align:middle;"&gt;&lt;a class="jive-link-wiki-small" href="/challenges-projects/element14-presents/benheck/ben-heck-exclusive/w/documents/9678/the-ben-heck-show-episode-archive" data-e14adj="t"&gt;&lt;span style="color:#ffffff;text-decoration:none;"&gt;See All Episodes&lt;/span&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;p style="margin:0;padding:0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;table style="width:80%;margin:0px auto;"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td style="padding-bottom:12px;"&gt;&lt;span&gt;&lt;a href="https://www.youtube.com/watch?v=3m9PfEXlJY8"&gt;www.youtube.com/watch&lt;/a&gt;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;p style="margin:0;border:1px solid #b8d7e5;background-color:#e9f6fc;padding:8px;max-width:634px;"&gt;&lt;span style="color:#000000;font-family:&amp;#39;Open Sans&amp;#39;, Arial, sans-serif;text-align:justify;"&gt;Karen walks you through the Spaceship Interface project which is included in the Arduino Starter Kit book.&amp;nbsp; For this project you’ll need an Arduino Uno the USB cable to plug into your computer, breadboard, jumpers, a tact switch, two red and one LEDs, three 220 ohm resistors for the LEDs, and one 10 kiloohm resistor. The code you’ll need to do this project is included in the &lt;span&gt;&lt;span class="e14-init-shown" id="addProduct-MiWAnV0P-linked" style="white-space:nowrap;"&gt;&lt;a class="jive-link-product-addtolist" href="https://www.element14.com/community/view-product.jspa?fsku=&amp;amp;nsku=85W1940&amp;amp;COM=noscript" target="_blank" data-e14adj="t"&gt;&lt;span class="pf-widget-map pf-productlink-cart-icon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;a class="jive-link-product pf-embedded-product-link" href="https://www.element14.com/community/view-product.jspa?fsku=&amp;amp;nsku=85W1940&amp;amp;COM=noscript" target="_blank" data-e14adj="t"&gt;Arduino Starter Kit&lt;/a&gt;&lt;/span&gt;&lt;span class="e14-init-hidden" id="addProduct-MiWAnV0P-unlinked"&gt;Arduino Starter Kit&lt;/span&gt;&lt;/span&gt; book.&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;p style="margin:0;padding:0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p style="margin:0;"&gt;The &lt;span&gt;&lt;span class="e14-init-shown" id="addProduct-54m9Jfp1-linked" style="white-space:nowrap;"&gt;&lt;a class="jive-link-product-addtolist" href="https://www.element14.com/community/view-product.jspa?fsku=2250862&amp;amp;nsku=47W2965&amp;amp;COM=noscript" target="_blank" data-e14adj="t"&gt;&lt;span class="pf-widget-map pf-productlink-cart-icon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;a class="jive-link-product pf-embedded-product-link" href="https://www.element14.com/community/view-product.jspa?fsku=2250862&amp;amp;nsku=47W2965&amp;amp;COM=noscript" target="_blank" data-e14adj="t"&gt;Arduino Starter Kit &lt;/a&gt;&lt;/span&gt;&lt;span class="e14-init-hidden" id="addProduct-54m9Jfp1-unlinked"&gt;Arduino Starter Kit &lt;/span&gt;&lt;/span&gt;book includes circuit diagrams and code which is referred to as sketches.&amp;nbsp; A sketch includes a set of functions followed by curly brackets, such as void setup () and void loop (). Anything you put in the curly brackets is the code that is executed when the function is called. Sometimes you will need to create what are known as variables for your code. A variable are items that you want your code to remember so that you can reference them later.&amp;nbsp; One good thing about variables is that if you use the same variable throughout your code and need to adjust the value of the variable, you only need to set the variable to another value at the top of the code.&amp;nbsp; Karen shows you how to set an integer as a variable for the project.&lt;/p&gt;&lt;p style="margin:0;padding:0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p style="margin:0;"&gt;After defining the variable, Karen moves along to the setup code. The setup is where we configure the pins so that the Arduino knows what’s an input, what’s an output, and which pins we’re using. In her code the 3 LED are designated as outputs, for pinMode, and the button is designated as an input for pinMode.&lt;/p&gt;&lt;p style="margin:0;padding:0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;int switchState = 0; // Holds the state of the Switch (HIGH - Pressed, LOW - Floating)
void setup(){   // The void setup function runs only once at the beginning. It is the place to define the OUTPUTs and INPUTs
  pinMode(3, OUTPUT);
  pinMode(4, OUTPUT); 
// configures pin 3 (digital) as an OUTPUT
  pinMode(5, OUTPUT);
  pinMode(2, INPUT);
}&lt;/pre&gt;&lt;/p&gt;&lt;div style="display:none;"&gt;&lt;/div&gt;&lt;p style="margin:0;padding:0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p style="margin:0;"&gt;When the code runs it will run once at the beginning to initialize and the loop will run over and over again.&amp;nbsp; The reason for the loop is to allow the Arduino to keep sensing the inputs and outputs.&amp;nbsp; Karen enters&amp;nbsp; the remaining code for the loop and walks you through what it means.&lt;/p&gt;&lt;p style="margin:0;padding:0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;int switchState = 0; // Holds the state of the Switch (HIGH - Pressed, LOW - Floating)
void setup(){   // The void setup function runs only once at the beginning. It is the place to define the OUTPUTs and INPUTs
  pinMode(3, OUTPUT);
  pinMode(4, OUTPUT); 
// configures pin 3 (digital) as an OUTPUT
  pinMode(5, OUTPUT);
  pinMode(2, INPUT);
}

void loop() { // This function will execute endlessly from the first to the last row
  switchState=digitalRead(2); // reads the digital Value of pin 2
  if (switchState == LOW) { 
// compares if the switchState corresponds to a LOW value. If the statement is true, it executes the orders contained within {}. Otherwise it ignores them. 
    digitalWrite(3, HIGH); // Sets the signal in 3 to HIGH (turn on the LED) and 4 and 5 to LOW (turn off the LEDs connected to 4 and 5)
    digitalWrite(4, LOW);
    digitalWrite(5, LOW);
  }
  else { // If the Switch is pressed, the program will ignore the &amp;#39;if&amp;#39; conditional and enter the &amp;#39;else&amp;#39;
    digitalWrite(3, LOW);
    digitalWrite(4, LOW); 
    digitalWrite(5, HIGH);
    delay(250); // Delays time for 250ms - a quarter of a second. It freezes the program during this time.
    digitalWrite(4, HIGH);
    digitalWrite(5, LOW);
    delay(250);
  }
}&lt;/pre&gt;&lt;/p&gt;&lt;div style="display:none;"&gt;&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;

&lt;div style="font-size: 90%;"&gt;Tags: tlc, arduino uno, arduino_vcp, e14presents_makerkaren, switches, io, simplified c, arduino ide, arduino_projects, arduino_tutorials, led, arduino_uno, arduino_classic, code, spaceship interface, arduino starter kit, stem projects, analog, thelearningcircuit&lt;/div&gt;
</description></item><item><title>The Learning Circuit 12: Arduino Starter Kit: Spaceship Interface</title><link>https://community.element14.com/challenges-projects/element14-presents/thelearningcircuit/w/documents/3648/arduino-starter-kit-spaceship-interference----the-learning-circuit-12/revision/1</link><pubDate>Sat, 04 Aug 2018 21:12:47 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:3953e376-f05d-45bc-a0ec-2f850146c917</guid><dc:creator>tariq.ahmad</dc:creator><comments>https://community.element14.com/challenges-projects/element14-presents/thelearningcircuit/w/documents/3648/arduino-starter-kit-spaceship-interference----the-learning-circuit-12#comments</comments><description>Revision 1 posted to Documents by tariq.ahmad on 8/4/2018 9:12:47 PM&lt;br /&gt;
&lt;table cellpadding="0" cellspacing="0" style="padding:0px;margin:0px;background-color:#c4e3ed;width:100%;"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td rowspan="3" style="padding-top:10px;padding-left:8px;vertical-align:top;"&gt;&lt;a href="/e14/assets/legacy/2017/BHlearningCir.png"&gt;&lt;img alt="image" class="nolightbox" src="/e14/assets/legacy/2017/BHlearningCir.png"  /&gt;&lt;/a&gt;&lt;/td&gt;&lt;td rowspan="3" style="vertical-align:top;padding:10px 13px 13px 8px;"&gt;&lt;p style="margin:0;font-size:18px;line-height:18px;font-weight:bold;padding-bottom:6px;"&gt;&lt;a class="jivecontainerTT-hover-container jive-link-community-small" href="/challengesprojects/element14-presents/benheck/"&gt;element14&amp;#39;s The Ben Heck Show&lt;/a&gt;&lt;/p&gt;&lt;p style="margin:0;padding-bottom:6px;line-height:18px;"&gt;Join Karen as she shares her enthusiasm for teaching STEM subjects, gives you what you need to know to get started on electronics projects, and more.&lt;/p&gt;&lt;p style="margin:0;"&gt;&lt;a href="/challengesprojects/element14-presents/benheck/"&gt;Back to The Ben Heck Show homepage &lt;img loading="lazy" alt="image" src="/e14/assets/legacy/gen/LinkArrow.gif"  /&gt;&lt;/a&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="padding:8px 10px;background-color:#004156;vertical-align:middle;" width="30%"&gt;&lt;a class="" href="https://www.element14.com/community/community/experts/benheck/thelearningcircuit?ICID=TLC-episodedoc-topban"&gt;&lt;span style="color:#ffffff;text-decoration:none;"&gt;The Learning Circuit&lt;/span&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style="padding:8px 10px;background-color:#005973;vertical-align:middle;"&gt;&lt;a class="jivecontainerTT-hover-container jive-link-community-small" href="/challengesprojects/element14-presents/benheck/ben-heck-exclusive/"&gt;&lt;span style="color:#ffffff;text-decoration:none;"&gt;Featured Bonus Content&lt;/span&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style="padding:8px 10px;background-color:#006f91;vertical-align:middle;"&gt;&lt;a class="jive-link-wiki-small" href="/challenges-projects/element14-presents/benheck/ben-heck-exclusive/w/documents/9678/the-ben-heck-show-episode-archive"&gt;&lt;span style="color:#ffffff;text-decoration:none;"&gt;See All Episodes&lt;/span&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;p style="margin:0;padding:0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;table style="width:80%;margin:0px auto;"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td style="padding-bottom:12px;"&gt;&lt;span&gt;&lt;a href="https://www.youtube.com/watch?v=3m9PfEXlJY8"&gt;www.youtube.com/watch&lt;/a&gt;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;p style="margin:0;border:1px solid #b8d7e5;background-color:#e9f6fc;padding:8px;max-width:634px;"&gt;&lt;span style="color:#000000;font-family:&amp;#39;Open Sans&amp;#39;, Arial, sans-serif;text-align:justify;"&gt;Karen walks you through the Spaceship Interface project which is included in the Arduino Starter Kit book.&amp;nbsp; For this project you’ll need an Arduino Uno the USB cable to plug into your computer, breadboard, jumpers, a tact switch, two red and one LEDs, three 220 ohm resistors for the LEDs, and one 10 kiloohm resistor. The code you’ll need to do this project is included in the &lt;span&gt;&lt;span class="e14-init-shown" id="addProduct-MiWAnV0P-linked" style="white-space:nowrap;"&gt;&lt;a class="jive-link-product-addtolist" href="https://www.element14.com/community/view-product.jspa?fsku=&amp;amp;nsku=85W1940&amp;amp;COM=noscript" target="_blank"&gt;&lt;span class="pf-widget-map pf-productlink-cart-icon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;a class="jive-link-product pf-embedded-product-link" href="https://www.element14.com/community/view-product.jspa?fsku=&amp;amp;nsku=85W1940&amp;amp;COM=noscript" target="_blank"&gt;Arduino Starter Kit&lt;/a&gt;&lt;/span&gt;&lt;span class="e14-init-hidden" id="addProduct-MiWAnV0P-unlinked"&gt;Arduino Starter Kit&lt;/span&gt;&lt;/span&gt; book.&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;p style="margin:0;padding:0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p style="margin:0;"&gt;The &lt;span&gt;&lt;span class="e14-init-shown" id="addProduct-54m9Jfp1-linked" style="white-space:nowrap;"&gt;&lt;a class="jive-link-product-addtolist" href="https://www.element14.com/community/view-product.jspa?fsku=2250862&amp;amp;nsku=47W2965&amp;amp;COM=noscript" target="_blank"&gt;&lt;span class="pf-widget-map pf-productlink-cart-icon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;a class="jive-link-product pf-embedded-product-link" href="https://www.element14.com/community/view-product.jspa?fsku=2250862&amp;amp;nsku=47W2965&amp;amp;COM=noscript" target="_blank"&gt;Arduino Starter Kit &lt;/a&gt;&lt;/span&gt;&lt;span class="e14-init-hidden" id="addProduct-54m9Jfp1-unlinked"&gt;Arduino Starter Kit &lt;/span&gt;&lt;/span&gt;book includes circuit diagrams and code which is referred to as sketches.&amp;nbsp; A sketch includes a set of functions followed by curly brackets, such as void setup () and void loop (). Anything you put in the curly brackets is the code that is executed when the function is called. Sometimes you will need to create what are known as variables for your code. A variable are items that you want your code to remember so that you can reference them later.&amp;nbsp; One good thing about variables is that if you use the same variable throughout your code and need to adjust the value of the variable, you only need to set the variable to another value at the top of the code.&amp;nbsp; Karen shows you how to set an integer as a variable for the project.&lt;/p&gt;&lt;p style="margin:0;padding:0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p style="margin:0;"&gt;After defining the variable, Karen moves along to the setup code. The setup is where we configure the pins so that the Arduino knows what’s an input, what’s an output, and which pins we’re using. In her code the 3 LED are designated as outputs, for pinMode, and the button is designated as an input for pinMode.&lt;/p&gt;&lt;p style="margin:0;padding:0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;int switchState = 0; // Holds the state of the Switch (HIGH - Pressed, LOW - Floating)
void setup(){   // The void setup function runs only once at the beginning. It is the place to define the OUTPUTs and INPUTs
  pinMode(3, OUTPUT);
  pinMode(4, OUTPUT); 
// configures pin 3 (digital) as an OUTPUT
  pinMode(5, OUTPUT);
  pinMode(2, INPUT);
}&lt;/pre&gt;&lt;/p&gt;&lt;div style="display:none;"&gt;&lt;/div&gt;&lt;p style="margin:0;padding:0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p style="margin:0;"&gt;When the code runs it will run once at the beginning to initialize and the loop will run over and over again.&amp;nbsp; The reason for the loop is to allow the Arduino to keep sensing the inputs and outputs.&amp;nbsp; Karen enters&amp;nbsp; the remaining code for the loop and walks you through what it means.&lt;/p&gt;&lt;p style="margin:0;padding:0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;int switchState = 0; // Holds the state of the Switch (HIGH - Pressed, LOW - Floating)
void setup(){   // The void setup function runs only once at the beginning. It is the place to define the OUTPUTs and INPUTs
  pinMode(3, OUTPUT);
  pinMode(4, OUTPUT); 
// configures pin 3 (digital) as an OUTPUT
  pinMode(5, OUTPUT);
  pinMode(2, INPUT);
}

void loop() { // This function will execute endlessly from the first to the last row
  switchState=digitalRead(2); // reads the digital Value of pin 2
  if (switchState == LOW) { 
// compares if the switchState corresponds to a LOW value. If the statement is true, it executes the orders contained within {}. Otherwise it ignores them. 
    digitalWrite(3, HIGH); // Sets the signal in 3 to HIGH (turn on the LED) and 4 and 5 to LOW (turn off the LEDs connected to 4 and 5)
    digitalWrite(4, LOW);
    digitalWrite(5, LOW);
  }
  else { // If the Switch is pressed, the program will ignore the &amp;#39;if&amp;#39; conditional and enter the &amp;#39;else&amp;#39;
    digitalWrite(3, LOW);
    digitalWrite(4, LOW); 
    digitalWrite(5, HIGH);
    delay(250); // Delays time for 250ms - a quarter of a second. It freezes the program during this time.
    digitalWrite(4, HIGH);
    digitalWrite(5, LOW);
    delay(250);
  }
}&lt;/pre&gt;&lt;/p&gt;&lt;div style="display:none;"&gt;&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;

&lt;div style="font-size: 90%;"&gt;Tags: tlc, arduino uno, arduino_vcp, e14presents_makerkaren, switches, io, simplified c, arduino ide, arduino_projects, arduino_tutorials, led, arduino_uno, arduino_classic, code, spaceship interface, arduino starter kit, stem projects, analog, thelearningcircuit&lt;/div&gt;
</description></item></channel></rss>