This tutorial is about the programming of GPIO Pins. Here we will explore how to interface LED and Switch with Arduino Uno. Arduino Uno has 14 digital I/O Pins which will be referred as GPIO. Now in this tutorial, we have presented two examples. One in which we will connect LED to PIN 13 of Arduino and blink it after every second. And later on, we will use PIN 7 to configure as input and learn how to interface switch to control the LED.
Program Blink LED with Arduino
After connecting LED and configuring Arduino pin into OUTPUT mode. Now It’s time to learn how to configure Arduino Pin to INPUT Mode. Let’s add button switch to our previous project and turn LED ON/OFF using Switch. In this example project we have to connect LED to PIN 13 of Arduino. The Switch will be connected to PIN 7 of Arduino. Make sure while connecting switch we will have to use pull up resistor of value 1K to 10K. The reason is because it’s an active low pin. Here is a circuit connection we need to do before uploading the sketch.
Program Switch to Arduino Uno
This is how we can interface LED and Switch with Arduino Uno. In next few tutorials, we’ll explore the use of GPIO pins to serve different purposes. We hope you’ll enjoy working with Arduino as it’s very easy to use hardware. If you have any question regarding code or circuit connection feel free to leave a comment. Thanking you.
Umesh Lokhande holds a Master degree in Scientific Instrumentation from University of Applied Sciences Jena, Germany. and has previously worked at Orbotech, Alere Technologies etc. Umesh is also a founder and first author of BINARYUPDATES.COM