{"id":29098,"date":"2020-01-11T18:15:31","date_gmt":"2020-01-11T10:15:31","guid":{"rendered":"\/blog\/?p=29098"},"modified":"2020-03-29T00:25:27","modified_gmt":"2020-03-28T16:25:27","slug":"how-to-use-a-switch-button-with-arduino-simple-tutorial","status":"publish","type":"post","link":"https:\/\/www.seeedstudio.com\/blog\/2020\/01\/11\/how-to-use-a-switch-button-with-arduino-simple-tutorial\/","title":{"rendered":"How to use a button with Arduino in 6 steps! &#8211; Simple Arduino Tutorial"},"content":{"rendered":"\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img fetchpriority=\"high\" decoding=\"async\" width=\"493\" height=\"384\" src=\"https:\/\/blog.seeedstudio.com\/wp-content\/uploads\/2020\/01\/how-to-use-switch-buttons-1.png\" alt=\"\" class=\"wp-image-29121\" srcset=\"https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2020\/01\/how-to-use-switch-buttons-1.png 493w, https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2020\/01\/how-to-use-switch-buttons-1-300x234.png 300w\" sizes=\"(max-width: 493px) 100vw, 493px\" \/><\/figure><\/div>\n\n\n\n<p>Own a switch or a push-button and wonder how you can easily connect it to an Arduino? In today&#8217;s simple tutorial, I&#8217;ll be teaching you the basics and how you can easily get started without any resistors!<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>List of Switch Buttons at Seeed<\/strong><\/h2>\n\n\n\n<p>Before we get started with our switch button tutorial, if you&#8217;ve yet to own one, do consider the wide array of options available here at Seeed! All of it Grove Compatible! <\/p>\n\n\n\n<p>Need a list rundown of the available switch options? We got you covered! ALL of our switch buttons here are Grove compatible! Not to mention they are very cost effective and much cheaper compared to other buttons.<\/p>\n\n\n\n<p class=\"has-text-color has-vivid-red-color\"><strong>Grove? What is Grove? <\/strong><\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>More about Grove<\/strong><\/h3>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img decoding=\"async\" src=\"https:\/\/github.com\/SeeedDocument\/wiki_english\/raw\/master\/docs\/images\/top_banner.png\" alt=\"\"\/><\/figure><\/div>\n\n\n\n<p>Grove system is Seeed very own initiative, mainly aimed at helping users like yourself to easily use different modules, sensors, and more through our plug and play system!<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>No more breadboarding, soldering and complicated electrical circuits<\/li><li>More than 200 Grove modules for you to choose from, including other sensor types for you to choose from!<\/li><\/ul>\n\n\n\n<p>Don\u2019t believe how easy pairing is made possible with Grove? Below shows a general Arduino switch pairing vs one of our Grove \u2013 Switch:<\/p>\n\n\n\n<figure class=\"wp-block-gallery columns-2 is-cropped wp-block-gallery-1 is-layout-flex wp-block-gallery-is-layout-flex\"><ul class=\"blocks-gallery-grid\"><li class=\"blocks-gallery-item\"><figure><img decoding=\"async\" width=\"800\" height=\"619\" src=\"https:\/\/blog.seeedstudio.com\/wp-content\/uploads\/2020\/01\/arduino-switch-circuit.jpg\" alt=\"\" data-id=\"29103\" class=\"wp-image-29103\" srcset=\"https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2020\/01\/arduino-switch-circuit.jpg 800w, https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2020\/01\/arduino-switch-circuit-300x232.jpg 300w, https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2020\/01\/arduino-switch-circuit-768x594.jpg 768w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><figcaption class=\"blocks-gallery-item__caption\">Arduino switch circuit with jumper wires and breadboard<\/figcaption><\/figure><\/li><li class=\"blocks-gallery-item\"><figure><img decoding=\"async\" width=\"1022\" height=\"679\" src=\"https:\/\/blog.seeedstudio.com\/wp-content\/uploads\/2020\/01\/grove-switch-pairing.jpg\" alt=\"\" data-id=\"29104\" data-full-url=\"https:\/\/blog.seeedstudio.com\/wp-content\/uploads\/2020\/01\/grove-switch-pairing.jpg\" data-link=\"\/blog\/?attachment_id=29104\" class=\"wp-image-29104\" srcset=\"https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2020\/01\/grove-switch-pairing.jpg 1022w, https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2020\/01\/grove-switch-pairing-300x199.jpg 300w, https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2020\/01\/grove-switch-pairing-768x510.jpg 768w\" sizes=\"(max-width: 1022px) 100vw, 1022px\" \/><figcaption class=\"blocks-gallery-item__caption\">Arduino switch circuit with Grove<\/figcaption><\/figure><\/li><\/ul><\/figure>\n\n\n\n<p class=\"has-text-color has-vivid-red-color\"><strong>Like how simple and less messy it is?<\/strong><\/p>\n\n\n\n<p><strong>All you need is a\u00a0<a href=\"https:\/\/www.seeedstudio.com\/Base-Shield-V2.html?utm_source=blog&amp;utm_medium=blog\">Grove Base Shield<\/a>\u00a0alongside your Arduino and you\u2019re good to go<\/strong> <strong>or get one of our <a href=\"https:\/\/www.seeedstudio.com\/seeeduino-boards-c-987.html\">Seeeduino&#8217;s<\/a> which is attached with a Grove interface<\/strong>.<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>We\u2019ll&nbsp;talk&nbsp;more&nbsp;about&nbsp;the&nbsp;pairing later on during our tutorial<\/li><\/ul>\n\n\n\n<p style=\"font-size:19px\"><strong>Now let\u2019s move on to our list of switches!<\/strong><\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>1) <a rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\" href=\"https:\/\/www.seeedstudio.com\/Grove-Switch-P.html?utm_source=blog&amp;utm_medium=blog\" target=\"_blank\">Grove &#8211; Switch (P)<\/a><\/strong> ($2.90)<\/h3>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/media-cdn.seeedstudio.com\/media\/catalog\/product\/cache\/ab187aaa5f626ad16c8031644cd2de5b\/h\/t\/httpsstatics3.seeedstudio.comimagesproductgroveswitchp.jpg\" alt=\"\" width=\"350\" height=\"263\"\/><\/figure><\/div>\n\n\n\n<p>Starting off the list is an entry-level low-cost switch for your every day ON\/OFF applications. If you&#8217;re looking for a reliable switch to simply get started and experience our grove prototyping system, this option is for you!<\/p>\n\n\n\n<p>If you&#8217;re wondering what the &#8220;P&#8221; means, it stands for &#8220;panel mount&#8221;<\/p>\n\n\n\n<p><strong>Its features and specifications include:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Ease of usage with Grove interface <\/li><li>Dimensions: 20mm x 20mm<\/li><li>Operating voltage:  3.\u2157V <\/li><li>Electrical life: 10,000 cycles<\/li><li>Operation Force:  200 \u00b1 50gf <\/li><li>Operation Temperature:  -20\u2103 to +80\u2103 <\/li><\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>2) <a rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\" href=\"https:\/\/www.seeedstudio.com\/Grove-Tilt-Switch.html?utm_source=blog&amp;utm_medium=blog\" target=\"_blank\">Grove &#8211; Tilt Switch <\/a><\/strong>($2.90)<\/h3>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/media-cdn.seeedstudio.com\/media\/catalog\/product\/cache\/ab187aaa5f626ad16c8031644cd2de5b\/h\/t\/httpsstatics3.seeedstudio.comseeedfile2018-07bazaar881140_3.jpg\" alt=\"\" width=\"350\" height=\"263\"\/><\/figure><\/div>\n\n\n\n<p>Instead of switching the button physically on and off, we have here the Grove &#8211; tilt switch, an equivalent of a button that does switching through tilting movement!<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>It contains a pair of balls inside that form an electrical connection when the case is placed upright<\/li><li>When the case is tilted over, the balls wouldn&#8217;t touch, hence no connection is made<\/li><\/ul>\n\n\n\n<p>Do note that this sensor is wired to the SIG line instead of using NC.<\/p>\n\n\n\n<p><strong>Its features and specifications include:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Ease of usage with Grove interface<\/li><li>Voltage levels:<ul><li>Minimum: 3V<\/li><li>Typical: 5V<\/li><li>Maximum: 5.25V<\/li><\/ul><\/li><li>Connecting angle: 10\u00b0 ~170\u00b0 <\/li><li>Disconnect angle: 190\u00b0 ~350\u00b0 <\/li><li>Electrical Life:  100,000 cycle<\/li><\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>3) <a rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\" href=\"https:\/\/www.seeedstudio.com\/Grove-Micro-Switch.html?utm_source=blog&amp;utm_medium=blog\" target=\"_blank\">Grove &#8211; Micro Switch<\/a><\/strong> ($2.90)<\/h3>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/media-cdn.seeedstudio.com\/media\/catalog\/product\/cache\/ab187aaa5f626ad16c8031644cd2de5b\/h\/t\/httpsstatics3.seeedstudio.comseeedfile2018-02bazaar705051_1.jpg\" alt=\"\" width=\"350\" height=\"263\"\/><\/figure><\/div>\n\n\n\n<p>If you&#8217;re looking for an electric switch that&#8217;s higher speed and applicable for industrial applications such as machinery, controls, appliances, etc., this switch option is the one for you!<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Being a micro switch that&#8217;s actuated by little physical force, a relatively small movement at the actuator button will produce a large movement at the electrical contacts<\/li><\/ul>\n\n\n\n<p>Similarly to the previous two options, it&#8217;s low-cost and easily pairable with your Arduino, Raspberry Pi, or other development platforms!<\/p>\n\n\n\n<p>Its features and specifications include:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Ease of usage with Grove interface <\/li><li>Dimensions: 40mm x 20mm x 20mm<\/li><li>Working voltage: 3.3V \/ 5V<\/li><li>Operating Force: 80\u00b120g <\/li><\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>4) <a rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\" href=\"https:\/\/www.seeedstudio.com\/Grove-Magnetic-Switch-p-744.html?utm_source=blog&amp;utm_medium=blog\" target=\"_blank\">Grove &#8211; Magnetic Switch<\/a><\/strong> ($2.90)<\/h3>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/media-cdn.seeedstudio.com\/media\/catalog\/product\/cache\/ab187aaa5f626ad16c8031644cd2de5b\/h\/t\/httpsstatics3.seeedstudio.comseeedfile2018-01bazaar676592_img_5740aa.jpg\" alt=\"\" width=\"350\" height=\"263\"\/><\/figure><\/div>\n\n\n\n<p>Looking for another type of switch that utilizes a different way of turning a circuit on and off? The Grove &#8211; Magnetic Switch does so through proximity!<\/p>\n\n\n\n<p>Based on the CT10 encapsulated dry reed switch which is a single-pole, single-throw (SPST type), this switch sensor is double-ended and can be actuated with an electromagnet, a permanent magnet of both!<\/p>\n\n\n\n<p><strong>Its features and specifications include:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Ease of usage through Grove interface<\/li><li>Small footprint: 2.0cm x 2.0cm twig module<\/li><li>Minimum external parts<\/li><li>10W rating<\/li><li>Rugged encapsulation<\/li><\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>5) <a rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\" href=\"https:\/\/www.seeedstudio.com\/Grove-5-Way-Switch.html?utm_source=blog&amp;utm_medium=blog\" target=\"_blank\">Grove &#8211; 5-Way Switch<\/a><\/strong> ($4.45)<\/h3>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/media-cdn.seeedstudio.com\/media\/catalog\/product\/cache\/ab187aaa5f626ad16c8031644cd2de5b\/h\/t\/httpsstatics3.seeedstudio.comseeedfile2018-09bazaar917041_111020048_9.jpg\" alt=\"\" width=\"350\" height=\"263\"\/><\/figure><\/div>\n\n\n\n<p>No.5 on this list goes to our 5-way switch. If you need multifunction control on your electrical circuit, this is a good option to consider!<\/p>\n\n\n\n<p>Not only can it be used to detect switch positions and events such as single click, double click or long-press, but directional detection (left, right, up, down, center) is also possible as well!<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>With its directional detection, it&#8217;s applicable for game controls<\/li><\/ul>\n\n\n\n<p>Its features and specifications include:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Ease of usage with Grove compatibility<\/li><li>I2C interface<\/li><li>Good heat resistance<\/li><li>Long operating life<\/li><li>Operating voltage: 3.3V \/ 5V<\/li><li>Dimensions: 40mm x 20mm x 10mm<\/li><\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">6) <strong><a rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\" href=\"https:\/\/www.seeedstudio.com\/Grove-6-Position-DIP-Switch.html?utm_source=blog&amp;utm_medium=blog\" target=\"_blank\">Grove &#8211; 6 Position DIP Switch<\/a><\/strong> ($3.90)<\/h3>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/media-cdn.seeedstudio.com\/media\/catalog\/product\/cache\/ab187aaa5f626ad16c8031644cd2de5b\/h\/t\/httpsstatics3.seeedstudio.comseeedfile2018-09bazaar917044_111020043_4.jpg\" alt=\"\" width=\"350\" height=\"263\"\/><\/figure><\/div>\n\n\n\n<p>No.6 on this list and 6 positions? Yes! Jokes aside, If One switch isn&#8217;t enough and you&#8217;re looking for a module with multi-channel capabilities, this switch option is for you!<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Integrating 6 individual switch positions in one, this option is great for just that! <\/li><\/ul>\n\n\n\n<p>It uses I2C for data transmission through the grove port as well, maintaining its ease of usage!<\/p>\n\n\n\n<p><strong>Its features and specifications include:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Inclusion of 6 individual switch<\/li><li>Good heat resistance <\/li><li>Long operating life<\/li><li>I2C interface<\/li><li>Grove compatible<\/li><li>Dimensions: 40mm x 20mm x 10mm<\/li><li>Operating voltage: 3.3V \/ 5V<\/li><\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>7) <a rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\" href=\"https:\/\/www.seeedstudio.com\/Grove-Button.html?utm_source=blog&amp;utm_medium=blog\" target=\"_blank\">Grove &#8211; Button<\/a><\/strong> ($1.90)<\/h3>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/media-cdn.seeedstudio.com\/media\/catalog\/product\/cache\/ab187aaa5f626ad16c8031644cd2de5b\/p\/e\/perspectiive.jpg\" alt=\"\" width=\"350\" height=\"263\"\/><\/figure><\/div>\n\n\n\n<p>After seeing 6 different switches on this list, it&#8217;s time to showcase a switch button! If you wish to ON\/OFF a circuit by pressing a button-down instead of flipping it, the Grove &#8211; Button is for you!<\/p>\n\n\n\n<p>This button is identical to our sister version <a href=\"https:\/\/www.seeedstudio.com\/Grove-Button-P.html?utm_source=blog&amp;utm_medium=blog\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\">Grove &#8211; Button (P)<\/a> apart from the placement of our Grove &#8211; connect port. <\/p>\n\n\n\n<p><strong>Its features and specifications include:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Easy to use momentary ON\/OFF button<\/li><li>Grove interface<\/li><li>Operating voltage:  3.\u2157V <\/li><li>Electrical life:  200,000 cycles <\/li><li>Operating force: 100 \u00b1 50gf<\/li><li>Operating temperature:  -25\u2103 to +70\u2103 <\/li><li>Dimensions:  20mmX20mm <\/li><\/ul>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<h2 class=\"has-text-color wp-block-heading\" style=\"color:#000000\" id=\"arduino-switch-tutorial\"><strong>Arduino Button tutorial<\/strong><\/h2>\n\n\n\n<p>Picked out the switch button that you will be using for your Arduino project? Lets head into how to use them with the Arduino! <\/p>\n\n\n\n<p>For this tutorial, we&#8217;ll be using our <strong><a href=\"https:\/\/www.seeedstudio.com\/Grove-Switch-P.html?utm_source=blog&amp;utm_medium=blog\">Grove &#8211; Switch (P)<\/a><\/strong> to show you how you can turn on an LED with Arduino.<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>We&#8217;ve provided an Arduino code and tutorial for the other switches on the list as well. If you&#8217;re interested in any, you may refer to the &#8220;Resources and Going Further&#8221; Section of today&#8217;s blog<\/li><\/ul>\n\n\n\n<p>To complete this tutorial, you&#8217;ll need the following parts:<\/p>\n\n\n\n<figure class=\"wp-block-gallery columns-4 is-cropped wp-block-gallery-2 is-layout-flex wp-block-gallery-is-layout-flex\"><ul class=\"blocks-gallery-grid\"><li class=\"blocks-gallery-item\"><figure><img loading=\"lazy\" decoding=\"async\" width=\"210\" height=\"157\" src=\"https:\/\/blog.seeedstudio.com\/wp-content\/uploads\/2020\/01\/seeeduino-v4.2-5.jpg\" alt=\"\" data-id=\"29108\" data-link=\"\/blog\/?attachment_id=29108\" class=\"wp-image-29108\"\/><figcaption class=\"blocks-gallery-item__caption\"><a href=\"http:\/\/www.seeedstudio.com\/Seeeduino-V4.2-p-2517.html?utm_source=blog&amp;utm_medium=blog\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\">Seeeduino V4.2<\/a><\/figcaption><\/figure><\/li><li class=\"blocks-gallery-item\"><figure><img loading=\"lazy\" decoding=\"async\" width=\"210\" height=\"157\" src=\"https:\/\/blog.seeedstudio.com\/wp-content\/uploads\/2020\/01\/base-shield-6.jpg\" alt=\"\" data-id=\"29109\" data-link=\"\/blog\/?attachment_id=29109\" class=\"wp-image-29109\"\/><figcaption class=\"blocks-gallery-item__caption\"><a href=\"https:\/\/www.seeedstudio.com\/Base-Shield-V2-p-1378.html?utm_source=blog&amp;utm_medium=blog\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\">Grove &#8211; Base Shield<\/a><\/figcaption><\/figure><\/li><li class=\"blocks-gallery-item\"><figure><img loading=\"lazy\" decoding=\"async\" width=\"210\" height=\"157\" src=\"https:\/\/blog.seeedstudio.com\/wp-content\/uploads\/2020\/01\/grove-switch-p.jpg\" alt=\"\" data-id=\"29111\" data-link=\"\/blog\/?attachment_id=29111\" class=\"wp-image-29111\"\/><figcaption class=\"blocks-gallery-item__caption\"><a href=\"https:\/\/www.seeedstudio.com\/Grove-Switch-P.html?utm_source=blog&amp;utm_medium=blog\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\">Grove &#8211; Switch (P)<\/a><\/figcaption><\/figure><\/li><li class=\"blocks-gallery-item\"><figure><img loading=\"lazy\" decoding=\"async\" width=\"210\" height=\"157\" src=\"https:\/\/blog.seeedstudio.com\/wp-content\/uploads\/2020\/01\/grove-purple-led.jpg\" alt=\"\" data-id=\"29112\" data-full-url=\"https:\/\/blog.seeedstudio.com\/wp-content\/uploads\/2020\/01\/grove-purple-led.jpg\" data-link=\"\/blog\/?attachment_id=29112\" class=\"wp-image-29112\"\/><figcaption class=\"blocks-gallery-item__caption\"><a href=\"https:\/\/www.seeedstudio.com\/Grove-Purple-LED-%283mm%29-p-1143.html?utm_source=blog&amp;utm_medium=blog\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\">Grove &#8211; Purple LED (3mm)<\/a><\/figcaption><\/figure><\/li><\/ul><\/figure>\n\n\n\n<ul class=\"wp-block-list\"><li>Seeeduino is Seeed\u2019s very own Arduino board, made with relative benefits over the original<ul><li>If you do not wish to purchase a Seeeduino, this tutorial is still applicable for the following Arduino boards: Arduino UNO, Arduino Mega, Arduino Leonardo, Arduino 101, Arduino Due <\/li><\/ul><\/li><\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Hardware Assembly<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Step 1:<\/strong> Connect Grove-Switch (P) to D2 port of Grove -Base Shield<\/li><li><strong>Step 2:<\/strong> Connect Grove &#8211; Purple LED to D6 of Grove &#8211; Base Shield<\/li><li><strong>Step 3: <\/strong>Plug Grove &#8211; Base Shield into Seeeduino<\/li><li><strong>Step 4:<\/strong> Connect Seeeduino to PC via a USB cable<\/li><\/ul>\n\n\n\n<p>It should look something like this after completing the above steps:<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/github.com\/SeeedDocument\/Grove-Switch-P\/raw\/master\/img\/seeeduino_switch_led.jpg\" alt=\"\" width=\"381\" height=\"253\"\/><\/figure><\/div>\n\n\n\n<p style=\"background-color:#fff3da\" class=\"has-background\">Note: If you wish, you can directly connect <a href=\"https:\/\/www.seeedstudio.com\/Grove-Purple-LED-%283mm%29-p-1143.html?utm_source=blog&amp;utm_medium=blog\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\">Grove-Switch(P)<\/a> and <a href=\"https:\/\/www.seeedstudio.com\/Grove-Purple-LED-%283mm%29-p-1143.html?utm_source=blog&amp;utm_medium=blog\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\">Grove &#8211; Purple LED (3mm)<\/a> to Seeeduino v4.2 instead of using a Grove &#8211; Base Shield since it has sufficient grove ports. <\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"\"><thead><tr><th>Seeeduino <\/th><th>Grove-Switch(P)<\/th><th>Seeeduino<\/th><th>Grove &#8211; Purple LED (3mm)<\/th><\/tr><\/thead><tbody><tr><td>5V<\/td><td>Red<\/td><td>5V<\/td><td>Red<\/td><\/tr><tr><td>GND<\/td><td>Black<\/td><td>GND<\/td><td>Black<\/td><\/tr><tr><td>NC<\/td><td>White<\/td><td>NC<\/td><td>White<\/td><\/tr><tr><td>D2<\/td><td>Yellow<\/td><td>D6<\/td><td>Yellow<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Arduino Code and Software configurations<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\"><li>Step 1: Copy the below code to Arduino IDE and upload it to Arduino  <ul><li>If you&#8217;re unsure on how to upload the code, do check out <a href=\"http:\/\/wiki.seeedstudio.com\/Upload_Code\/\">our guide on uploading code here<\/a><\/li><\/ul><\/li><\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>const int switchPin = 2;     \/\/ the number of the pushbutton pin\nconst int ledPin =  6;      \/\/ the number of the LED pin\n\nint switchState = 0;         \/\/ variable for reading the pushbutton status\n\nvoid setup() {\n    \/\/ initialize the LED pin as an output:\n    pinMode(ledPin, OUTPUT);\n    \/\/ initialize the switch pin as an input:\n    pinMode(switchPin, INPUT);\n    Serial.begin(9600);\n}\n\nvoid loop(){\n    \/\/ read the state of the switch value:\n    switchState = digitalRead(switchPin);\n\n    if (switchState == HIGH) {\n        \/\/turn LED on:\n        digitalWrite(ledPin, HIGH);\n        Serial.println(\"switch high!\");\n    }\n    else {\n        \/\/turn LED off:\n        digitalWrite(ledPin, LOW);\n        Serial.println(\"switch low\");\n    }\n}<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\"><li>Step 2: The LED will now be on when we switch it to high! The serial output will be displayed as below:<\/li><\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>switch high!\nswitch high!\nswitch high!<\/code><\/pre>\n\n\n\n<p>If you&#8217;re both an Audio and Visual learner, here&#8217;s a video tutorial on what I&#8217;ve gone through earlier!<\/p>\n\n\n\n<figure class=\"wp-block-embed-youtube wp-block-embed is-type-video is-provider-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe title=\"Lesson 5 : Button and LED Grove modules\" width=\"640\" height=\"360\" src=\"https:\/\/www.youtube.com\/embed\/RCtsxwx4OaA?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe>\n<\/div><\/figure>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<h2 class=\"wp-block-heading\"><strong><span style=\"text-decoration: underline;\">Switch Button Projects<\/span><\/strong><\/h2>\n\n\n\n<p>Since the only thing you could try with switch buttons is the above tutorial, I&#8217;ve provided some other projects for you to get started!<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Arduino BoomBox <\/strong><\/h3>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/statics3.seeedstudio.com\/images\/recipe\/img\/recipe\/2015-03\/5510c3d74f1a2.jpg\" alt=\"\" width=\"386\" height=\"290\"\/><\/figure><\/div>\n\n\n\n<p>Want to build a custom boombox that&#8217;s cheaper than those pre-build ones on the market? This project uses the Grove Serial MP3 paired with Arduino UNO and others to help you achieve that!<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>What do you need?<\/strong><\/h4>\n\n\n\n<p><strong>Hardware components:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><a href=\"https:\/\/www.seeedstudio.com\/Arduino-Uno-Rev3-p-2995.html?utm_source=blog&amp;utm_medium=blog\">Ar<\/a><a href=\"https:\/\/www.seeedstudio.com\/Arduino-Uno-Rev3-p-2995.html?utm_source=blog&amp;utm_medium=blog\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\"duino UNO\u2028Grove - Button\u2028Grove - Switch (P) \u2028Grove - Base Shield\u2028Grove - Serial MP3 Player\u2028Grove - Slide Potentiometer\u2028Grove - Universal 4 Pin 20cm Unbuckled Cable (5 PCs Pack)\u20284xAA Battery Holder (opens in a new tab)\">duino UNO<\/a><\/li><li><a href=\"https:\/\/www.seeedstudio.com\/Arduino-Uno-Rev3-p-2995.html?utm_source=blog&amp;utm_medium=blog\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\"duino UNO\u2028Grove - Button\u2028Grove - Switch (P) \u2028Grove - Base Shield\u2028Grove - Serial MP3 Player\u2028Grove - Slide Potentiometer\u2028Grove - Universal 4 Pin 20cm Unbuckled Cable (5 PCs Pack)\u20284xAA Battery Holder (opens in a new tab)\">Grove &#8211; Button<\/a><\/li><li><a href=\"https:\/\/www.seeedstudio.com\/Arduino-Uno-Rev3-p-2995.html?utm_source=blog&amp;utm_medium=blog\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\"duino UNO\u2028Grove - Button\u2028Grove - Switch (P) \u2028Grove - Base Shield\u2028Grove - Serial MP3 Player\u2028Grove - Slide Potentiometer\u2028Grove - Universal 4 Pin 20cm Unbuckled Cable (5 PCs Pack)\u20284xAA Battery Holder (opens in a new tab)\">Grove &#8211; Switch (P) <\/a><\/li><li><a href=\"https:\/\/www.seeedstudio.com\/Arduino-Uno-Rev3-p-2995.html?utm_source=blog&amp;utm_medium=blog\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\"duino UNO\u2028Grove - Button\u2028Grove - Switch (P) \u2028Grove - Base Shield\u2028Grove - Serial MP3 Player\u2028Grove - Slide Potentiometer\u2028Grove - Universal 4 Pin 20cm Unbuckled Cable (5 PCs Pack)\u20284xAA Battery Holder (opens in a new tab)\">Grove &#8211; Base Shield<\/a><\/li><li><a href=\"https:\/\/www.seeedstudio.com\/Arduino-Uno-Rev3-p-2995.html?utm_source=blog&amp;utm_medium=blog\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\"duino UNO\u2028Grove - Button\u2028Grove - Switch (P) \u2028Grove - Base Shield\u2028Grove - Serial MP3 Player\u2028Grove - Slide Potentiometer\u2028Grove - Universal 4 Pin 20cm Unbuckled Cable (5 PCs Pack)\u20284xAA Battery Holder (opens in a new tab)\">Grove &#8211; Serial MP3 Player<\/a><\/li><li><a href=\"https:\/\/www.seeedstudio.com\/Arduino-Uno-Rev3-p-2995.html?utm_source=blog&amp;utm_medium=blog\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\"duino UNO\u2028Grove - Button\u2028Grove - Switch (P) \u2028Grove - Base Shield\u2028Grove - Serial MP3 Player\u2028Grove - Slide Potentiometer\u2028Grove - Universal 4 Pin 20cm Unbuckled Cable (5 PCs Pack)\u20284xAA Battery Holder (opens in a new tab)\">Grove &#8211; Slide Potentiometer<\/a><\/li><li><a href=\"https:\/\/www.seeedstudio.com\/Arduino-Uno-Rev3-p-2995.html?utm_source=blog&amp;utm_medium=blog\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\"duino UNO\u2028Grove - Button\u2028Grove - Switch (P) \u2028Grove - Base Shield\u2028Grove - Serial MP3 Player\u2028Grove - Slide Potentiometer\u2028Grove - Universal 4 Pin 20cm Unbuckled Cable (5 PCs Pack)\u20284xAA Battery Holder (opens in a new tab)\">Grove &#8211; Universal 4 Pin 20cm Unbuckled Cable (5 PCs Pack)<\/a><\/li><li><a href=\"https:\/\/www.seeedstudio.com\/Arduino-Uno-Rev3-p-2995.html?utm_source=blog&amp;utm_medium=blog\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\"duino UNO\u2028Grove - Button\u2028Grove - Switch (P) \u2028Grove - Base Shield\u2028Grove - Serial MP3 Player\u2028Grove - Slide Potentiometer\u2028Grove - Universal 4 Pin 20cm Unbuckled Cable (5 PCs Pack)\u20284xAA Battery Holder (opens in a new tab)\">4xAA Battery Holder<\/a><\/li><\/ul>\n\n\n\n<p><strong>Software apps and other services:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Arduino IDE<\/li><\/ul>\n\n\n\n<p>Interested in finding out more? You can check out the <a href=\"https:\/\/community.seeedstudio.com\/Arduino+BoomBox+-p-171.html\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\">full tutorial by ArduinoBasics<\/a> on SeeedStudio Community!<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>DIY Wooden Laser Gun<\/strong><\/h3>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/raw.githubusercontent.com\/SeeedDocument\/Grove_Button\/master\/img\/gun.jpg\" alt=\"\" width=\"389\" height=\"234\"\/><\/figure><\/div>\n\n\n\n<p>Into Guns and want to DIY one for yourself? This project is the one for you! Inspired by Overwatch, this gun is made from wood and works by emitting a laser pulse, activating the light sensors installed on gun targets. <\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>What do you need?<\/strong><\/h4>\n\n\n\n<p><strong>Hardware components:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><a href=\"https:\/\/www.seeedstudio.com\/Seeeduino-Lotus-V1-1-ATMega328-Board-with-Grove-Interface.html?utm_source=blog&amp;utm_medium=blog\">Seeeduino Lotus <\/a><\/li><li>5mW Laser Module Emitter &#8211; Red Point<\/li><li><a href=\"https:\/\/www.seeedstudio.com\/Grove-LED-Bar-v2.0-p-2474.html?utm_source=blog&amp;utm_medium=blog\">Grove &#8211; LED Bar v2.0<\/a><\/li><li><a href=\"https:\/\/www.seeedstudio.com\/Grove-Vibration-Motor-p-839.html?utm_source=blog&amp;utm_medium=blog\">Grove &#8211; Vibration Motor<\/a><\/li><li><a href=\"https:\/\/www.seeedstudio.com\/Grove-Button.html?utm_source=blog&amp;utm_medium=blog\">Grove &#8211; Button (P)<\/a><\/li><li><a href=\"https:\/\/www.seeedstudio.com\/EMAX-9g-ES08A-High-Sensitive-Mini-Servo-p-760.html?utm_source=blog&amp;utm_medium=blog\">Servo <\/a><\/li><li><a href=\"https:\/\/www.seeedstudio.com\/Grove-Light-Sensor-v1.2-p-2727.html?utm_source=blog&amp;utm_medium=blog\">Grove &#8211; Light Sensor v1.2 (P)<\/a><\/li><li><a href=\"https:\/\/www.seeedstudio.com\/Grove-4-Digit-Display-p-1198.html?utm_source=blog&amp;utm_medium=blog\">Grove &#8211; 4 Digit Display<\/a><\/li><li><a href=\"https:\/\/www.seeedstudio.com\/Grove-Buzzer-p-768.html?utm_source=blog&amp;utm_medium=blog\">Grove Buzzer<\/a><\/li><\/ul>\n\n\n\n<p><strong>Structural components:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Rubber band<\/li><li>Support column M3*25 <\/li><li>Support column M3*30<\/li><li>Support column M3*50<\/li><li>Support column M3*20<\/li><li>M3 screws and nuts<\/li><li>M2 screws and nuts<\/li><li>Screwdriver<\/li><li>3mm thick wood planks<\/li><li>5mm thick wood planks<\/li><\/ul>\n\n\n\n<p><strong>Software apps and other services:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Arduino IDE<\/li><\/ul>\n\n\n\n<p><strong>Machinery:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>General Laser cutter<\/li><\/ul>\n\n\n\n<p>Interested in finding out more? You can check out the<a href=\"https:\/\/www.instructables.com\/id\/DIY-a-Wooden-Laser-Gun-As-a-Xmas-Present-for-Your-\/\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\"> full tutorial by SeeedStudio<\/a> on Instructables!<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>LED String Light<\/strong><\/h3>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/hackster.imgix.net\/uploads\/attachments\/300313\/img_6846_Oyyg2ARVdv.JPG?auto=compress%2Cformat&amp;w=900&amp;h=675&amp;fit=min\" alt=\"\" width=\"380\" height=\"286\"\/><\/figure><\/div>\n\n\n\n<p>Want to build an LED display more impressive than the regular LED sensor? With this project, you can learn how to connect your Arduino board to LED string lights!<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>What do you need?<\/strong><\/h4>\n\n\n\n<p><strong>Hardware components:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Arduino UNO &amp; Genuino UNO<\/li><li><a href=\"https:\/\/www.seeedstudio.com\/Base-Shield-V2-p-1378.html?utm_source=blog&amp;utm_medium=blog\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\"Seeed Grove Base Shield\u2028Seeed Grove LED String Light\u2028Seeed Grove Universal Buckled Cable\u2028Seeed Grove Button (opens in a new tab)\">Seeed Grove Base Shield<\/a><\/li><li><a href=\"https:\/\/www.seeedstudio.com\/Base-Shield-V2-p-1378.html?utm_source=blog&amp;utm_medium=blog\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\"Seeed Grove Base Shield\u2028Seeed Grove LED String Light\u2028Seeed Grove Universal Buckled Cable\u2028Seeed Grove Button (opens in a new tab)\">Seeed Grove LED String Light<\/a><\/li><li><a href=\"https:\/\/www.seeedstudio.com\/Base-Shield-V2-p-1378.html?utm_source=blog&amp;utm_medium=blog\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\"Seeed Grove Base Shield\u2028Seeed Grove LED String Light\u2028Seeed Grove Universal Buckled Cable\u2028Seeed Grove Button (opens in a new tab)\">Seeed Grove Universal Buckled Cable<\/a><\/li><li><a href=\"https:\/\/www.seeedstudio.com\/Base-Shield-V2-p-1378.html?utm_source=blog&amp;utm_medium=blog\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\"Seeed Grove Base Shield\u2028Seeed Grove LED String Light\u2028Seeed Grove Universal Buckled Cable\u2028Seeed Grove Button (opens in a new tab)\">Seeed Grove Button<\/a><\/li><li>Seeed Analog LED Strip<\/li><\/ul>\n\n\n\n<p><strong>Software apps and other services:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><a href=\"https:\/\/create.arduino.cc\/editor\">Arduino Web Editor<\/a><\/li><\/ul>\n\n\n\n<p><strong>Hand tools and fabrication machines:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Soldering iron (only applicable if you change the LED Strip)<\/li><\/ul>\n\n\n\n<p>Interested in finding out more? You can check out <a href=\"https:\/\/www.hackster.io\/ingo-lohs\/grove-introduction-in-a-button-led-string-light-f7e4d6\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\">the full tutorial by Ingo Lohs<\/a> on Hackster.io!<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Universal Remote Control <\/strong><\/h3>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/hackster.imgix.net\/uploads\/attachments\/846344\/Slide1.PNG?auto=compress%2Cformat&amp;w=900&amp;h=675&amp;fit=min\" alt=\"\" width=\"387\" height=\"290\"\/><\/figure><\/div>\n\n\n\n<p>With switch buttons being applicable in very much all that involves a circuit, a single button press on the remote in this project will convert it to precise Sony IR signal combinations (E.g. Turn on the TV and then switch channels). Impressive? Here&#8217;s what you need!<\/p>\n\n\n\n<p><strong>Hardware components:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><a href=\"https:\/\/www.seeedstudio.com\/Arduino-Uno-Rev3-p-2995.html?utm_source=blog&amp;utm_medium=blog\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\"Arduino Uno \u2028Grove - Base Shield\u2028Grove - Infrared Receiver\u2028Grove Button\u2028Grove 16x2 LCD (White on Blue) (opens in a new tab)\">Arduino Uno <\/a><\/li><li><a href=\"https:\/\/www.seeedstudio.com\/Arduino-Uno-Rev3-p-2995.html?utm_source=blog&amp;utm_medium=blog\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\"Arduino Uno \u2028Grove - Base Shield\u2028Grove - Infrared Receiver\u2028Grove Button\u2028Grove 16x2 LCD (White on Blue) (opens in a new tab)\">Grove &#8211; Base Shield<\/a><\/li><li><a href=\"https:\/\/www.seeedstudio.com\/Arduino-Uno-Rev3-p-2995.html?utm_source=blog&amp;utm_medium=blog\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\"Arduino Uno \u2028Grove - Base Shield\u2028Grove - Infrared Receiver\u2028Grove Button\u2028Grove 16x2 LCD (White on Blue) (opens in a new tab)\">Grove &#8211; Infrared Receiver<\/a><\/li><li><a href=\"https:\/\/www.seeedstudio.com\/Arduino-Uno-Rev3-p-2995.html?utm_source=blog&amp;utm_medium=blog\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\"Arduino Uno \u2028Grove - Base Shield\u2028Grove - Infrared Receiver\u2028Grove Button\u2028Grove 16x2 LCD (White on Blue) (opens in a new tab)\">Grove Button<\/a><\/li><li><a href=\"https:\/\/www.seeedstudio.com\/Arduino-Uno-Rev3-p-2995.html?utm_source=blog&amp;utm_medium=blog\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\"Arduino Uno \u2028Grove - Base Shield\u2028Grove - Infrared Receiver\u2028Grove Button\u2028Grove 16x2 LCD (White on Blue) (opens in a new tab)\">Grove 16&#215;2 LCD (White on Blue)<\/a><\/li><li>KEYES IR Remote control<\/li><li>SONY IR Remote control<\/li><\/ul>\n\n\n\n<p><strong>Software apps and other services<\/strong>:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Arduino IDE<\/li><\/ul>\n\n\n\n<p>Interested in finding out more? You can check out the <a href=\"https:\/\/www.hackster.io\/ArduinoBasics\/grove-ir-universal-remote-project-7ab87f\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\">full tutorial by ScottC <\/a>on Hackster.io! <\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Positive Habit Enforcement Device<\/strong><\/h3>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/hackster.imgix.net\/uploads\/attachments\/1050406\/_x86nXqWLW4.blob?auto=compress%2Cformat&amp;w=900&amp;h=675&amp;fit=min\" alt=\"\" width=\"366\" height=\"274\"\/><\/figure><\/div>\n\n\n\n<p>Remember those new year resolutions you told yourself that you&#8217;re going to achieve? Well, chances are they&#8217;ll be broken before January ends. Hence, to avoid such behavior, you can build this device for behavior modification!<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>What do you need?<\/strong><\/h4>\n\n\n\n<p><strong>Hardware components:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><a href=\"https:\/\/www.seeedstudio.com\/Particle-Photon-SMALL-AND-POWERFUL-WI-FI-CONNECTED-MICROCONTROLLER-p-2527.html?utm_source=blog&amp;utm_medium=blog\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\">Particle Photon<\/a><\/li><li>Driver DRV8825 for Stepper Motors for Theremino System<\/li><li>Stepper Motor, Mini Step<\/li><li>2828 OLED<\/li><li><a href=\"https:\/\/www.seeedstudio.com\/Grove-Micro-Switch.html?utm_source=blog&amp;utm_medium=blog\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\">Seeed Grove Micro Switch<\/a><\/li><li>Pushbutton Switch, Momentary<\/li><\/ul>\n\n\n\n<p><strong>Software apps and online services:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><a href=\"https:\/\/www.hackster.io\/products\/buy\/248?s=BAhJIhMzMTE5ODAsUHJvamVjdAY6BkVG%0A\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\"Autodesk Fusion 360\u2028Particle Build Web IDE\u2028Microsoft VS Code (opens in a new tab)\">Autodesk Fusion 360<\/a><\/li><li><a href=\"https:\/\/www.hackster.io\/products\/buy\/248?s=BAhJIhMzMTE5ODAsUHJvamVjdAY6BkVG%0A\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\"Autodesk Fusion 360\u2028Particle Build Web IDE\u2028Microsoft VS Code (opens in a new tab)\">Particle Build Web IDE<\/a><\/li><li><a href=\"https:\/\/www.hackster.io\/products\/buy\/248?s=BAhJIhMzMTE5ODAsUHJvamVjdAY6BkVG%0A\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\"Autodesk Fusion 360\u2028Particle Build Web IDE\u2028Microsoft VS Code (opens in a new tab)\">Microsoft VS Code<\/a><\/li><\/ul>\n\n\n\n<p><strong>Hand tools and fabrication machines<\/strong>:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>3D printer <\/li><\/ul>\n\n\n\n<p>Interested in finding out more? You can check out <a href=\"https:\/\/www.hackster.io\/gatoninja236\/positive-habit-enforcement-device-916d65\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\">the full tutorial by Arduino &#8220;having11&#8221; Guy<\/a> on Hackster.io!<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Resources and Going Further<\/strong><\/h2>\n\n\n\n<p>We&#8217;ve provided an Arduino code and tutorial for most of the other switches on the list as well. Here are its resources:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><a href=\"http:\/\/wiki.seeedstudio.com\/Grove-Tilt_Switch\/\">Grove &#8211; Tilt Switch<\/a><\/li><li>Grove &#8211; Micro Switch<\/li><li><a href=\"http:\/\/wiki.seeedstudio.com\/Grove-Magnetic_Switch\/\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\"Grove - Magnetic Switch\u2028Grove - 5-way Switch\u2028Grove - 6 position DIP Switch\u2028Grove - Button (opens in a new tab)\">Grove &#8211; Magnetic Switch<\/a><\/li><li><a href=\"http:\/\/wiki.seeedstudio.com\/Grove-Magnetic_Switch\/\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\"Grove - Magnetic Switch\u2028Grove - 5-way Switch\u2028Grove - 6 position DIP Switch\u2028Grove - Button (opens in a new tab)\">Grove &#8211; 5-way Switch<\/a><\/li><li><a href=\"http:\/\/wiki.seeedstudio.com\/Grove-Magnetic_Switch\/\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\"Grove - Magnetic Switch\u2028Grove - 5-way Switch\u2028Grove - 6 position DIP Switch\u2028Grove - Button (opens in a new tab)\">Grove &#8211; 6 position DIP Switch<\/a><\/li><li><a href=\"http:\/\/wiki.seeedstudio.com\/Grove-Magnetic_Switch\/\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\"Grove - Magnetic Switch\u2028Grove - 5-way Switch\u2028Grove - 6 position DIP Switch\u2028Grove - Button (opens in a new tab)\">Grove &#8211; Button<\/a><\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Summary<\/strong><\/h2>\n\n\n\n<p>That\u2019s all for today on switch and buttons. I hope with today\u2019s blog, you get a deeper understanding of how you can easily control an LED with Arduino!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Own a switch or a push-button and wonder how you can easily connect it to<\/p>\n","protected":false},"author":2850,"featured_media":29120,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_lmt_disableupdate":"","_lmt_disable":"","_price":"","_stock":"","_tribe_ticket_header":"","_tribe_default_ticket_provider":"","_tribe_ticket_capacity":"0","_ticket_start_date":"","_ticket_end_date":"","_tribe_ticket_show_description":"","_tribe_ticket_show_not_going":false,"_tribe_ticket_use_global_stock":"","_tribe_ticket_global_stock_level":"","_global_stock_mode":"","_global_stock_cap":"","_tribe_rsvp_for_event":"","_tribe_ticket_going_count":"","_tribe_ticket_not_going_count":"","_tribe_tickets_list":"[]","_tribe_ticket_has_attendee_info_fields":false,"iawp_total_views":0,"footnotes":""},"categories":[1],"tags":[1112,22,1021],"class_list":["post-29098","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-news","tag-arduino-sensor","tag-button","tag-switch"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.0 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to use a button with Arduino in 6 steps! - Simple Arduino Tutorial - Latest News from Seeed Studio<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.seeedstudio.com\/blog\/2020\/01\/11\/how-to-use-a-switch-button-with-arduino-simple-tutorial\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to use a button with Arduino in 6 steps! - Simple Arduino Tutorial - Latest News from Seeed Studio\" \/>\n<meta property=\"og:description\" content=\"Own a switch or a push-button and wonder how you can easily connect it to\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.seeedstudio.com\/blog\/2020\/01\/11\/how-to-use-a-switch-button-with-arduino-simple-tutorial\/\" \/>\n<meta property=\"og:site_name\" content=\"Latest News from Seeed Studio\" \/>\n<meta property=\"article:published_time\" content=\"2020-01-11T10:15:31+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2020-03-28T16:25:27+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2020\/01\/how-to-use-switch-buttons.png\" \/>\n\t<meta property=\"og:image:width\" content=\"493\" \/>\n\t<meta property=\"og:image:height\" content=\"384\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Shawn\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Shawn\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"10 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.seeedstudio.com\/blog\/2020\/01\/11\/how-to-use-a-switch-button-with-arduino-simple-tutorial\/\",\"url\":\"https:\/\/www.seeedstudio.com\/blog\/2020\/01\/11\/how-to-use-a-switch-button-with-arduino-simple-tutorial\/\",\"name\":\"How to use a button with Arduino in 6 steps! - Simple Arduino Tutorial - Latest News from Seeed Studio\",\"isPartOf\":{\"@id\":\"https:\/\/www.seeedstudio.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.seeedstudio.com\/blog\/2020\/01\/11\/how-to-use-a-switch-button-with-arduino-simple-tutorial\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.seeedstudio.com\/blog\/2020\/01\/11\/how-to-use-a-switch-button-with-arduino-simple-tutorial\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2020\/01\/how-to-use-switch-buttons.png\",\"datePublished\":\"2020-01-11T10:15:31+00:00\",\"dateModified\":\"2020-03-28T16:25:27+00:00\",\"author\":{\"@id\":\"https:\/\/www.seeedstudio.com\/blog\/#\/schema\/person\/c9b61b761840d544e2d830b0e3bc9fe2\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.seeedstudio.com\/blog\/2020\/01\/11\/how-to-use-a-switch-button-with-arduino-simple-tutorial\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.seeedstudio.com\/blog\/2020\/01\/11\/how-to-use-a-switch-button-with-arduino-simple-tutorial\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.seeedstudio.com\/blog\/2020\/01\/11\/how-to-use-a-switch-button-with-arduino-simple-tutorial\/#primaryimage\",\"url\":\"https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2020\/01\/how-to-use-switch-buttons.png\",\"contentUrl\":\"https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2020\/01\/how-to-use-switch-buttons.png\",\"width\":493,\"height\":384,\"caption\":\"how to use a switch button with Arduino - Simple Tutorial\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.seeedstudio.com\/blog\/2020\/01\/11\/how-to-use-a-switch-button-with-arduino-simple-tutorial\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.seeedstudio.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to use a button with Arduino in 6 steps! &#8211; Simple Arduino Tutorial\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.seeedstudio.com\/blog\/#website\",\"url\":\"https:\/\/www.seeedstudio.com\/blog\/\",\"name\":\"Latest News from Seeed Studio\",\"description\":\"Emerging IoT, AI and Autonomous Applications on the Edge\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.seeedstudio.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.seeedstudio.com\/blog\/#\/schema\/person\/c9b61b761840d544e2d830b0e3bc9fe2\",\"name\":\"Shawn\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.seeedstudio.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/5afdc71205d9d485de69bc4b192294e3?s=96&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/5afdc71205d9d485de69bc4b192294e3?s=96&r=g\",\"caption\":\"Shawn\"},\"url\":\"https:\/\/www.seeedstudio.com\/blog\/author\/shawn\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to use a button with Arduino in 6 steps! - Simple Arduino Tutorial - Latest News from Seeed Studio","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":"https:\/\/www.seeedstudio.com\/blog\/2020\/01\/11\/how-to-use-a-switch-button-with-arduino-simple-tutorial\/","og_locale":"en_US","og_type":"article","og_title":"How to use a button with Arduino in 6 steps! - Simple Arduino Tutorial - Latest News from Seeed Studio","og_description":"Own a switch or a push-button and wonder how you can easily connect it to","og_url":"https:\/\/www.seeedstudio.com\/blog\/2020\/01\/11\/how-to-use-a-switch-button-with-arduino-simple-tutorial\/","og_site_name":"Latest News from Seeed Studio","article_published_time":"2020-01-11T10:15:31+00:00","article_modified_time":"2020-03-28T16:25:27+00:00","og_image":[{"width":493,"height":384,"url":"https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2020\/01\/how-to-use-switch-buttons.png","type":"image\/png"}],"author":"Shawn","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Shawn","Est. reading time":"10 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.seeedstudio.com\/blog\/2020\/01\/11\/how-to-use-a-switch-button-with-arduino-simple-tutorial\/","url":"https:\/\/www.seeedstudio.com\/blog\/2020\/01\/11\/how-to-use-a-switch-button-with-arduino-simple-tutorial\/","name":"How to use a button with Arduino in 6 steps! - Simple Arduino Tutorial - Latest News from Seeed Studio","isPartOf":{"@id":"https:\/\/www.seeedstudio.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.seeedstudio.com\/blog\/2020\/01\/11\/how-to-use-a-switch-button-with-arduino-simple-tutorial\/#primaryimage"},"image":{"@id":"https:\/\/www.seeedstudio.com\/blog\/2020\/01\/11\/how-to-use-a-switch-button-with-arduino-simple-tutorial\/#primaryimage"},"thumbnailUrl":"https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2020\/01\/how-to-use-switch-buttons.png","datePublished":"2020-01-11T10:15:31+00:00","dateModified":"2020-03-28T16:25:27+00:00","author":{"@id":"https:\/\/www.seeedstudio.com\/blog\/#\/schema\/person\/c9b61b761840d544e2d830b0e3bc9fe2"},"breadcrumb":{"@id":"https:\/\/www.seeedstudio.com\/blog\/2020\/01\/11\/how-to-use-a-switch-button-with-arduino-simple-tutorial\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.seeedstudio.com\/blog\/2020\/01\/11\/how-to-use-a-switch-button-with-arduino-simple-tutorial\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.seeedstudio.com\/blog\/2020\/01\/11\/how-to-use-a-switch-button-with-arduino-simple-tutorial\/#primaryimage","url":"https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2020\/01\/how-to-use-switch-buttons.png","contentUrl":"https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2020\/01\/how-to-use-switch-buttons.png","width":493,"height":384,"caption":"how to use a switch button with Arduino - Simple Tutorial"},{"@type":"BreadcrumbList","@id":"https:\/\/www.seeedstudio.com\/blog\/2020\/01\/11\/how-to-use-a-switch-button-with-arduino-simple-tutorial\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.seeedstudio.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How to use a button with Arduino in 6 steps! &#8211; Simple Arduino Tutorial"}]},{"@type":"WebSite","@id":"https:\/\/www.seeedstudio.com\/blog\/#website","url":"https:\/\/www.seeedstudio.com\/blog\/","name":"Latest News from Seeed Studio","description":"Emerging IoT, AI and Autonomous Applications on the Edge","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.seeedstudio.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.seeedstudio.com\/blog\/#\/schema\/person\/c9b61b761840d544e2d830b0e3bc9fe2","name":"Shawn","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.seeedstudio.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/5afdc71205d9d485de69bc4b192294e3?s=96&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/5afdc71205d9d485de69bc4b192294e3?s=96&r=g","caption":"Shawn"},"url":"https:\/\/www.seeedstudio.com\/blog\/author\/shawn\/"}]}},"modified_by":"yida","views":13801,"featured_image_urls":{"full":["https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2020\/01\/how-to-use-switch-buttons.png",493,384,false],"thumbnail":["https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2020\/01\/how-to-use-switch-buttons-80x80.png",80,80,true],"medium":["https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2020\/01\/how-to-use-switch-buttons-300x234.png",300,234,true],"medium_large":["https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2020\/01\/how-to-use-switch-buttons.png",493,384,false],"large":["https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2020\/01\/how-to-use-switch-buttons.png",493,384,false],"1536x1536":["https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2020\/01\/how-to-use-switch-buttons.png",493,384,false],"2048x2048":["https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2020\/01\/how-to-use-switch-buttons.png",493,384,false],"visody_icon":["https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2020\/01\/how-to-use-switch-buttons.png",32,25,false],"magazine-7-slider-full":["https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2020\/01\/how-to-use-switch-buttons.png",493,384,false],"magazine-7-slider-center":["https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2020\/01\/how-to-use-switch-buttons.png",493,384,false],"magazine-7-featured":["https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2020\/01\/how-to-use-switch-buttons.png",493,384,false],"magazine-7-medium":["https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2020\/01\/how-to-use-switch-buttons.png",488,380,false],"magazine-7-medium-square":["https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2020\/01\/how-to-use-switch-buttons.png",493,384,false]},"author_info":{"display_name":"Shawn","author_link":"https:\/\/www.seeedstudio.com\/blog\/author\/shawn\/"},"category_info":"<a href=\"https:\/\/www.seeedstudio.com\/blog\/category\/news\/\" rel=\"category tag\">News<\/a>","tag_info":"News","comment_count":"0","_links":{"self":[{"href":"https:\/\/www.seeedstudio.com\/blog\/wp-json\/wp\/v2\/posts\/29098","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.seeedstudio.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.seeedstudio.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.seeedstudio.com\/blog\/wp-json\/wp\/v2\/users\/2850"}],"replies":[{"embeddable":true,"href":"https:\/\/www.seeedstudio.com\/blog\/wp-json\/wp\/v2\/comments?post=29098"}],"version-history":[{"count":3,"href":"https:\/\/www.seeedstudio.com\/blog\/wp-json\/wp\/v2\/posts\/29098\/revisions"}],"predecessor-version":[{"id":30698,"href":"https:\/\/www.seeedstudio.com\/blog\/wp-json\/wp\/v2\/posts\/29098\/revisions\/30698"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.seeedstudio.com\/blog\/wp-json\/wp\/v2\/media\/29120"}],"wp:attachment":[{"href":"https:\/\/www.seeedstudio.com\/blog\/wp-json\/wp\/v2\/media?parent=29098"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.seeedstudio.com\/blog\/wp-json\/wp\/v2\/categories?post=29098"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.seeedstudio.com\/blog\/wp-json\/wp\/v2\/tags?post=29098"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}