Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Circuit Schematic
Circuit Schematic
Note: Don’t worry too much about the triangles at the top and bottom! The LED is something
called a “diode,” which is just like a resistor but it only lets current through one way (in the
direction of the arrow).
We put the second resistor there to limit the current; if there is too much current through a
circuit, it will overload it and fry out!
Circuit Schematic
The Arduino can act as a battery that turns on and off according to our code. When it is on,
current flows through the LED and the resistor, and this current causes the light to turn on in the
LED. When the Arduino battery is off, there is essentially no battery connected to the circuit and
so the light turns off.
Building the Circuit
Picture
Schematic Picture
Picture
If it isn’t working after about 30 seconds, try uploading the code again. If it’s
still not working, let us know and we can help you debug!
Changing the Physical Circuit
Q: What happens if we lower the resistance?
Changing the Physical Circuit
Q: What happens if we lower the resistance?
A: The LED gets brighter! This is because lower resistance means higher
current, and the higher current makes the LED shine more brightly.
Changing the Code
So far our LED can blink at a steady pace, but that’s not very useful.
This link will take you to a Google Drive. Look for two files named
“morse_code_led.” Open the text file and copy/paste it into the online editor. If
this doesn’t work, download the other file (ending in “.ino”) and then upload it
to the editor -- we can help you with this.
Future Steps
1. Change the delay and message in the code; feel free to change variables
and add functionality if you want. If it breaks, you can always copy the
code from the drive link again.
2. Add a button to the circuit so that it turns on/off when you hit the button.
3. Add an ultrasonic sensor to the circuit so that it greets you with a
message when you walk up to it.
4. Use a photovoltaic sensor to create a “receiver” circuit that can read and
decode your blinking light back into English.
Button Sensor
Button Sensor
Tips for code:
In setup, set pin 9 as an input pin with the command pinMode(9, INPUT);
If the button is not pressed (switch is open) then it will return LOW
Use a boolean variable to keep track of whether the light is on already, and
then use if statements to decide whether to turn it on or off
Button Sensor
3 4
Tips for circuit:
Connect the 5V pin to the red rail and GND to the blue rail so you can
use
them for both sensing the button press and powering the LED.
Distance Sensor
Distance Sensor
Coding Tips