0% found this document useful (0 votes)
7 views5 pages

Arduino Interface: Button, LED, OLED, LCD

The document provides an overview of various electronic components including button switches, LEDs, OLEDs, and LCDs, detailing their functions, applications, and interfacing with Arduino Uno. It includes circuit descriptions and example programs for interfacing each component with Arduino. Each section outlines the necessary components, connections, and code to successfully implement the projects.

Uploaded by

sanjusanjay12134
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views5 pages

Arduino Interface: Button, LED, OLED, LCD

The document provides an overview of various electronic components including button switches, LEDs, OLEDs, and LCDs, detailing their functions, applications, and interfacing with Arduino Uno. It includes circuit descriptions and example programs for interfacing each component with Arduino. Each section outlines the necessary components, connections, and code to successfully implement the projects.

Uploaded by

sanjusanjay12134
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Overview of Button Switch, LED, OLED and LCD

Button Switch:

 A button switch is a simple input device used to control electronic circuits manually.

 It works by connecting or disconnecting a circuit when pressed.

 In Arduino, it is used as a digital input (HIGH or LOW).

 Applications: Start/stop control, menu selection, reset control.

LED (Light Emitting Diode):

A LED emits light when current flows through it in the forward direction.

Used as an output indicator in Arduino projects.

Requires a current-limiting resistor (typically 220Ω–330Ω).

Applications: Status indicators, debugging, lighting projects.

OLED Display:
 OLED (Organic Light Emitting Diode) is a thin, bright display that doesn’t need
backlight.
 It communicates with Arduino using I2C or SPI communication.
 Advantages: Low power, high contrast, small size.
 Applications: Displaying text, sensor readings, and graphics.

LCD (Liquid Crystal Display):

 A 16x2 LCD can display 2 lines with 16 characters each.


 It uses either a parallel interface or an I2C module for easy connection.
 Applications: Displaying sensor data, menus, messages.

Interfacing Button Switch with Arduino Uno

Components Required:

 Arduino Uno
 Push button switch
 10kΩ pull-down resistor
 Jumper wires

Circuit Description:

 One terminal of button → Arduino pin 2


 Other terminal → +5V
 10kΩ resistor → from pin 2 to GND (pull-down resistor)
Program:

int buttonPin = 2;

int ledPin = 13;

int buttonState = 0;

void setup() {

pinMode(buttonPin, INPUT);

pinMode(ledPin, OUTPUT);

void loop() {

buttonState = digitalRead(buttonPin);

if (buttonState == HIGH) {

digitalWrite(ledPin, HIGH);

} else {

digitalWrite(ledPin, LOW);

Explanation:

When the button is pressed, the input becomes HIGH, turning ON the LED connected
to pin 13.

Interfacing LED with Arduino Uno Board

Components:

 Arduino Uno
 LED
 220Ω resistor
 Jumper wires

Circuit:

 LED anode → pin 13 (through resistor)


 Cathode → GND
Program:

int ledPin = 13;

void setup() {

pinMode(ledPin, OUTPUT);

void loop() {

digitalWrite(ledPin, HIGH);

delay(1000);

digitalWrite(ledPin, LOW);

delay(1000);

Explanation:

LED turns ON and OFF every second, creating a blinking effect.

Interfacing OLED with Arduino Uno Board

Components:

 Arduino Uno
 0.96" OLED Display (I2C type)
 Jumper wires

Connections (I2C):

 VCC → 5V
 GND → GND
 SDA → A4
 SCL → A5

Program:

#include <Wire.h>

#include <Adafruit_GFX.h>

#include <Adafruit_SSD1306.h>
#define SCREEN_WIDTH 128

#define SCREEN_HEIGHT 64

Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, -1);

void setup() {

[Link](SSD1306_SWITCHCAPVCC, 0x3C);

[Link]();

[Link](1);

[Link](WHITE);

[Link](0, 10);

[Link]("Hello, Arduino!");

[Link]();

void loop() { }

Explanation:

The OLED displays a simple text message. I2C address (0x3C) may vary with
models.

Interfacing LCD with Arduino Uno Board

Components:

 Arduino Uno
 16x2 LCD Display with I2C module
 Jumper wires

Connections:

 VCC → 5V
 GND → GND
 SDA → A4
 SCL → A5

Program:

#include <Wire.h>
#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x27, 16, 2);

void setup() {

[Link]();

[Link]();

[Link](0, 0);

[Link]("Arduino LCD Demo");

[Link](0, 1);

[Link]("Hello Students!");

void loop() { }

Explanation:

The LCD displays two lines of text using the I2C interface.

You might also like