Lab 3 - Serial Communication
Lab 3 - Serial Communication
Students are responsible for submitting the final report by the stated deadline for full
marks. Late submissions will NOT be accepted.
Learning Objective: At the end of this Lab, students will be able to:
NOTE: The final report should be written in English and submitted with the
programming source files.
- Good luck -
1
IUH. Lecturer – Le Ngoc Tran, Ph.D.
Hardware Requirement
# Device Quantity
1 Arduino Board 1
2 BreadBoard 1
3 LED 3
4 Resistor 220Ω, 1k 5
5 Arduino USB connector 1
6 Jumper Wires (male, female) 10
7 Buzzer (speaker) 1
8
Software Requirement
# Software Quantity
1 Arduino IDE 1
2 Fritzing tool 1
3 Visual Studio 2013 1
Report Requirement
1. Submit the Arduino source code
2. Final report (word): include the circuit diagram (by Fritzing tool) and the photo
taken when the circuit is running
2
IUH. Lecturer – Le Ngoc Tran, Ph.D.
Hardware requirements
# Device Quantity
1 Arduino Board 1
2 BreadBoard 1
3 Buzzer 1
4 Resistor 220Ω 1
5 USB connector 1
6 Jumper Wires 10
Description
- A Piezo is an electronic piece that
converts electricity energy to sound. It is a
digital output device. You can make white
noise or even exact musical notes
(frequencies for musical notes) based on
the duration that you iterate between
HIGH and LOW signals.
- A Piezo is a directional piece, meaning
that it has a positive and negative pole.
- The positive pole should be connected to
the digital output pin that you allocate to
control the piezo and the negative pole
should be connected to Ground pin
Coding sample
3
IUH. Lecturer – Le Ngoc Tran, Ph.D.
4
IUH. Lecturer – Le Ngoc Tran, Ph.D.
void setup()
{
pinMode(buzzerPin, OUTPUT);
digitalWrite(buzzerPin, HIGH);
}
void loop()
{
digitalWrite(buzzerPin, HIGH);
delay(2000);
digitalWrite(buzzerPin, LOW);
delay(2000);
}
Experiment Procedure
Hardware requirements
# Device Quantity
1 Arduino Board 1
2 BreadBoard 1
3 LED 1
4 Resistor 220Ω 2
5 USB connector 1
6 Jumper Wires 10
7 Buzzer 1
Procedure
5
IUH. Lecturer – Le Ngoc Tran, Ph.D.
Reference:
http://www.instructables.com/id/Arduino-Function-Serialread-And-
SerialreadString/
https://arduinogetstarted.com/reference/serial-readstringuntil
Hardware requirements
# Device Quantity
1 Arduino Board 1
2 BreadBoard 1
3 LED 1
4 Resistor 220Ω 2
5 USB connector 1
6 Jumper Wires 10
7 Buzzer 1
Reference:
https://www.arduino.cc/en/Tutorial/PlayMelody
(see the attached file for details)
Procedure
6
IUH. Lecturer – Le Ngoc Tran, Ph.D.
Procedure
http://arduino.vn/bai-viet/902-c-sharp-c-mot-cach-dieu-khien-arduino-bang-may-tinh