Introduction: Arduino LED

Hi, today I will be showing you how to use the push button with Arduino to make funny things with the LEDs using Tinkercad. We're gonna make the LED signal an SOS once the button is pushed, and say "Vacation" in Morse code.

But first, we're gonna need the tools.

Step 1: Step 1: the Tools

For this we're going to need:

FIrst we need the tools.
-1 Red LED

-1 Green LED

-1 Yellow LED

-3 100 ohm resistors

-1 10k ohm resistor

-1 Arduino Uno R3

-1 Small Breadboard

For the wires, you can click on the spaces in the breadboard or the Arduino. You can also choose the color. Make sure the colors are relevant to prevent confusion.

Step 2: Step 2: the Assembly

You are going to want your project to look like this.

When that's done, we can start with coding the Arduino.

Step 3: Step 3: Coding - Mode 1

This is where the magic happens. You are gonna need a base code to make the system functional. Then you can add your touches. The base code that I used is given in the text document.

And now we have to Code the Arduino so that the red LED flashes, representing an SOS signal.

This can be done in 2 ways:

1. Write a series of HIGHs and LOWs.

2. Randomize the LED so that it turns on and off randomly by using "digitalWrite(led1Pin, random(0,2));".

Step 4: Step 4: Coding - Mode 2

For Mode 2, we want to make the LEDs flash so that they say the word "Vacation" in Morse code.

For this, I used the red light with a short delay to represent the dot, and the green with a longer delay to represent the dash.

You can see the image of the codes and what letter they represents and a picture of a Morse code chart.

Step 5: Step 5: Coding - Mode 3

You're almost done! We just need an ending. This step isn't really important, you can do whatever you want. I chose to make all the LEDs turn off, so that when we push the button again the whole process loops. But who knows, you might have a grand idea in mind, don't be afraid to try it.

Step 6: The Test

Now that you're officially done with your code, you need to test it.

You need to start the simulation first. After that press the button once to enter Mode 1. If everything is going according to your code, you can press the button again to enter step 2. However, you are going to want to hold the button for about 5 seconds, since Mode 1 has a delay it needs to finish.

Once you're in Mode 2, check if all the LEDs are flashing right.

Hold the button for about 1 second to transition into Mode 3. The end.

You can restart this process as much as you like.