9
ET 320 – Microprocessors Assignment #1 – LEDs with DIPs switches By Bach Nguyen Instructor: Dr. Cris Koutsougeras

LEDs and DIPs Switches

Embed Size (px)

Citation preview

Page 1: LEDs and DIPs Switches

ET 320 – Microprocessors

Assignment #1 – LEDs with DIPs switches

By Bach Nguyen

Instructor: Dr. Cris Koutsougeras

Page 2: LEDs and DIPs Switches

Abstract

LEDs and DIPs switches are common electronic objects that are the foundation of

modern electronics. LED lighting products use light emitting diodes to produce light very

efficiently. An electrical current passes through semiconductor material, which illuminates the

tiny light sources we call LEDs. The heat produced is absorbed into a heat sink. Common LED

colors include amber, red, green, and blue. Colored LEDs are widely used as signal lights and

indicator lights, like the power button on a computer. LEDs are better than fluorescent and

incandescent light bulbs considering the less power and space consumption. A dip switch is a set

of small switches in a dual in-line package (DIP) that is used to change the operating mode of a

device. Dip switches are used to configure computer peripherals such as hard drives, modems,

sound cards, and motherboards.

Objective

A prototyping board will be equipped with dip switches and LEDs. An array of 4

switches which can be placed in random on-off combinations by a user. The Arduino must

continuously read the values of the 4 switches and display the array of values on a corresponding

output array of LEDs. So the LEDs must indicate the positions of the switches at all times.

Warning: there must be no direct signal path from the switches to the LEDs. The LEDs must be

under the control of the Arduino and its programming.

Methodology and Schematics

Arduino Codes:

int led1 = 2;int led2 = 3;int led3 = 4;int led4 = 5;int s1 = 6;int s2 = 7;

Page 3: LEDs and DIPs Switches

int s3 = 8;int s4 = 9;

// the setup routine runs once when you press reset:void setup() { // initialize the digital pin as an output. pinMode(led1, OUTPUT); pinMode(led2, OUTPUT); pinMode(led3, OUTPUT); pinMode(led4, OUTPUT); pinMode(s1, INPUT); pinMode(s2, INPUT); pinMode(s3, INPUT); pinMode(s4, INPUT);}

// the loop routine runs over and over again forever:void loop() { if (digitalRead(s1) == HIGH){ digitalWrite(led1,HIGH); } else digitalWrite(led1,LOW); if (digitalRead(s2) == HIGH){ digitalWrite(led2,HIGH); } else digitalWrite(led2,LOW); if (digitalRead(s3) == HIGH){ digitalWrite(led3,HIGH); } else digitalWrite(led3,LOW); if (digitalRead(s4) == HIGH){ digitalWrite(led4,HIGH); } else digitalWrite(led4,LOW); delay(100);}

Schematic:

Page 4: LEDs and DIPs Switches
Page 5: LEDs and DIPs Switches

The switches are wired to the Arduino as inputs and the outputs are perceiving as LEDs

according to the switches. When the switches are turn on the LEDs will be turn on according to

which ever switch is in on position.

Protoboard Application

Page 6: LEDs and DIPs Switches
Page 7: LEDs and DIPs Switches

Troubleshooting and Improvement

There are not really any inherit issues with the design since it’s quite simple and straight

forward. Improvement that could be made to the design is that the switches could be changed to

smaller DIPs switches, bigger LEDs for better viewing.

Conclusion

This project has helped myself demonstrate the use of a simple circuit that can be

controlled by an Arduino.

Page 8: LEDs and DIPs Switches

Work Cited

https://circuits.io/circuits/3731694-et-320-assignment-1-led-and-dips-switches#breadboard –

Circuits and schematics

"Learn About LED Bulbs." ENERGY STAR. N.p., n.d. Web. 01 Feb. 2017.

"What Is Dip Switch?" What Is Dip Switch? N.p., n.d. Web. 01 Feb. 2017.