Make an Mp3 Player

From Wiki

Jump to: navigation, search

Kit List

Introduction:
Arduino advanced kit provided by ELECFREAKS is based on our starter kit to expand more and more popular modules owing the characteristics of plug and use without any requirement of soldering. We have well prepared six courses for learners to learn the usage of modules in an intersting environment which is better for stimulating your thinking mind. For example,Tetris games help us to study the usage of the LCD screen and Arduino program. Color picker used can help us to learn the color sensor as well as BLE Bluetooth communication and Android interface development ... Practical Course included LCD screen, sensor, MP3, BLE, WIFI, Android development, and image interaction (processing), make you open-minded!


Project 3 - Traffic Lights

We are now going to create a set of UK traffic lights that will change from green to red, via amber, and back again, after a set length of time using the 4-state system. This project could be used on a model railway to make a set ofworkingtraffic lights or for a childʼs toy town.10.png

What you will need

11.png

Connect it up

12.png

This time we have connected 3 LEDʼs with the Anode of each one going to Digital Pins 8, 9 and 10, via a 220Ω resistor each.

We have taken a jumper wire from Ground to the Ground rail at the top of the breadboard and a ground wire goes from the Cathode leg of each LED to the common ground rail.

Enter the code

Enter the following code, check it and upload.

If youʼve read up on Projects 1 & 2 then this code will be self explanatory as will the hardware.

// Project 3 - Traffic Lights
int ledDelay = 10000; // delay in between changes
int redPin = 10;
int yellowPin = 9;
int greenPin = 8;
void setup() {
pinMode(redPin, OUTPUT);
pinMode(yellowPin, OUTPUT);
pinMode(greenPin, OUTPUT);
}
void loop() {
// turn the red light on
digitalWrite(redPin, HIGH);
delay(ledDelay); // wait 5 seconds
digitalWrite(yellowPin, HIGH); // turn on yellow
delay(2000); // wait 2 seconds
digitalWrite(greenPin, HIGH); // turn green on
digitalWrite(redPin, LOW); // turn red off
digitalWrite(yellowPin, LOW); // turn yellow off
delay(ledDelay); // wait ledDelay milliseconds
digitalWrite(yellowPin, HIGH); // turn yellow on
digitalWrite(greenPin, LOW); // turn green off
delay(2000); // wait 2 seconds
digitalWrite(yellowPin, LOW); // turn yellow off
// now our loop repeats
}

In the next project, we are going add to this project by including a set of pedestrian lights and adding a push button to make the lights interactive.

Personal tools
Namespaces
Variants
Actions
Navigation
Support
Toolbox