MorseCodeWithArduino Download 1
MorseCodeWithArduino Download 1
Prep Work
● Create an Arduino Create account:
Terminology
https://create.arduino.cc/editor Arduino
● Follow the instructions to install the Arduino
“Arduino is an open-source
plug-in. This will let the web browser
communicate with the Arduino Uno. Read this electronics platform based on
article to learn more about the Arduino Create easy-to-use hardware and
Editor or if you have any trouble installing the
software. Arduino boards are
plug-in:
http://bit.ly/arduino-editor-getting-started able to read inputs - light on a
● Work through the example project to get sensor, a finger on a button, or
familiar with the hardware and software and a Twitter message - and turn it
ensure everything is working correctly:
into an output - activating a
http://bit.ly/arduino-morse-code-eg
● Go over the slides the for the lesson: motor, turning on an LED,
http://bit.ly/arduino-morse-code-slides publishing something online.
1
● Print the solutions sheet: You can tell your board what to
http://bit.ly/arduino-morse-code-solution do by sending a set of
instructions to the
Materials (per pair):
- Laptops with administrator permissions microcontroller on the board.
- Arduino Uno To do so you use the Arduino
- An A B USB cable (USB printer cable) to connect
programming language (based
the Arduino Uno to the laptop
on Wiring), and the Arduino
Lesson Software (IDE), based on
Use the following slides for this lesson: Processing.”
http://bit.ly/arduino-morse-code-slides →https://www.arduino.cc/en/G
uide/Introduction
Introduction
Robots are devices that can carry out a series of
complex actions. They can be programmed by a Curricular Connections
computer and can respond to their environment. Text-based coding, digital
Robots already exist in our daily lives, though we may output devices, electronics,
not recognize it. Have you ever been to a store where components of an electric
the door magically opens as you approach it? There is circuit, electrical components,
robotics in the background that makes that magic
PCB (printed circuit boards),
happen.
input/output devices,
Robots work in a simple 3 step process: input, microcontrollers,
processing, and output. This is quite similar to how
communication, impacts of
humans work as well; we take in information, our brain
processes it and makes a decision, and then our body technology on societies
reacts. So if you see a snake, your brain recognizes that
it is dangerous and commands your body to run! References
Similarly, hardware and software can work together to
Arduino Create
do cool things and react to their surroundings.
https://create.arduino.cc/
We’ll be using a microcontroller, called the Arduino Arduino Uno
Uno, to write a message in Morse Code. The Arduino
https://store.arduino.cc/usa/ar
Uno acts as the brain of our robot. Watch a snippet of
this video to learn more: duino-uno-rev3
https://youtu.be/CqrQmQqpHXc?t=20s (0:20 - 1:22) Arduino Reference
https://www.arduino.cc/referen
*Video also included in the slides
ce/en/
2
Code Along
Open up the example project and show learners the code and physical output (blinking
light).
Point out the main elements of the code: comments, setup, loop, and commands. Explain
the purpose of each of the commands using the descriptions in the adjacent comments.
Check for understanding by asking learners what would happen if you change the first
delay(1000) to delay(500). What would happen if you change the second delay(1000) to
delay(2000)?
Demonstrate the effect of changing the value of the delays in the code. This should change
the speed at which the light blinks. Don’t forget to verify and upload the code each time
you want to show learners the effect of the change.
Activity
In this activity, you’ll spell a word in Morse Code using an LED.
Morse Code is a way to communicate text information using a combination of dots and
dashes to represent letters. The dots and dashes could be broadcast using sounds or light.
S.O.S. is a famous sequence of letters that sailors used as a distress signal.
For example, S in Morse Code is dot dot dot (...) and O is dash dash dash (---), which is used
to spell SOS. (See slides for example gif)
3
6. Run the existing code
7. Comment out existing code
8. Add first letter (replace S.O.S. with the letters of the chosen word)
9. Add remaining letters
10. End the word
11. Check your code
12. Verify and upload the code to the Arduino Uno.
Have a partner decode the pattern of blinking lights to ensure the learner has spelled their
word correctly.
Assessment
● After reviewing the example project, co-construct success criteria with the class to
be used to evaluate their final projects.
● Have learners research the following programming concepts and explain how they
used them in their project: Functions, Loops, Sequence
Extensions
Program the built-in LED on the Arduino Uno to flash the same word in Morse code, but
instead of using the functions dot, dash, end_of_letter, and end_of_word, have learners use
the following commands:
● digitalWrite(LED_BUILTIN, HIGH); // turns the LED on
● digitalWrite(LED_BUILTIN, LOW); // turns the LED off
● delay(1000); // pauses the system. use appropriate delay values (in milliseconds)
A dot is a light that's on for 500 milliseconds. A dash is a light that is on for 1,500
milliseconds. The LED is off for 2000 milliseconds between letters and for 5000 milliseconds
between words.
4
Arduino | Solution Sheet
4. A light on the Arduino Uno should be flashing dot dot dot, dash dash
dash, dot dot dot.
2. The editor is the area where all the code is written. The 3 important parts
of the editor are the a) setup function, b) loop function, and c) comments.
a. The setup function runs once when you power or reset the board.
This is where hardware can be initialised or set up for the first time.
b. The loop function runs over and over again. Code that is placed in
the loop function will continue to run so long as the board is
powered. This is where the majority of the code is executed.
c. Comments are text that does not affect the code. They an
important part of the coding process and help programmers
document and understand what is going on. Use 2 forward slashes
(//) to start a comment. Any text on the line after // will be ignored
by the Arduino Uno.
3. Other important concepts include:
a. Functions: functions are blocks of code that have names. setup and
loop are examples of functions. The code that belongs to a function
lives within the curly brackets that follow the function’s name. Using
the same format we can create functions of our own. These custom
blocks of code are extremely useful as they make it easy to reuse
code and reduce repetition.
4. A light on the Arduino Uno should be flashing on for 1 second and off for
1 second.