(Created page with "=objective= In this tutorial, we will see how we could interface a simple switch to micrcontroller. Yes, it is indeed very simple, later in this tutorial we will do some logic...")
(No difference)

Revision as of 19:49, 18 December 2013

objective

In this tutorial, we will see how we could interface a simple switch to micrcontroller. Yes, it is indeed very simple, later in this tutorial we will do some logical operations with LEDs and Switches.

If we directly connect a switch to one of the microcontroller port pins, the pin floats when the switch is open. Meaning, it is not at a fixed logic level 0v or 5v. Hence we pull the pin up through a resistor to 5v(LOGIC 1), as shown in the figure 1. Now, whenever the switch is pressed, it grounds(LOGIC 0) the port pin.