Mastering Arduino Serial Communication

Mastering Arduino Serial Communication
1 / 19
suivant
Slide 1: Diapositive
ArduinoHigher Education (non-degree)

Cette leçon contient 19 diapositives, avec quiz interactifs et diapositives de texte.

time-iconLa durée de la leçon est: 60 min

Éléments de cette leçon

Mastering Arduino Serial Communication

Slide 1 - Diapositive

Cet élément n'a pas d'instructions

Learning Objective
At the end of the lesson, you will be able to understand and use Arduino Serial communication functions and analogRead.

Slide 2 - Diapositive

Cet élément n'a pas d'instructions

Text
What do you already know about Arduino Serial communication?

Slide 3 - Carte mentale

Cet élément n'a pas d'instructions

Arduino Serial.print()
The Serial.print() function is used to send data from Arduino to the computer for debugging and monitoring.

Slide 4 - Diapositive

Cet élément n'a pas d'instructions

Practical Example: Serial.print()
Write a program to send sensor readings to the serial monitor using Serial.print().

Slide 5 - Diapositive

Cet élément n'a pas d'instructions

Practical Example: Serial.print()
 +5V --------------------- VCC (Motion Sensor)
 GND --------------------- GND (Motion Sensor)
 D2 (Digital Pin 2) ------- OUT (Motion Sensor)


Slide 6 - Diapositive

Cet élément n'a pas d'instructions

Practical Example: Serial.print()

Slide 7 - Diapositive

Cet élément n'a pas d'instructions

Understanding Serial.available()
Serial.available() checks if there are any incoming serial data available for reading.

Slide 8 - Diapositive

Cet élément n'a pas d'instructions

Arduino Serial.read() and Serial.write()
Serial.read() reads the incoming serial data, while Serial.write() sends binary data to the serial port.

Slide 9 - Diapositive

Cet élément n'a pas d'instructions

Practical Exercise: Serial.read() and Serial.write()
Create a program to read and write data through the serial port using Serial.read() and Serial.write().

Slide 10 - Diapositive

Cet élément n'a pas d'instructions

Practical Exercise: Serial.read() and Serial.write()

Slide 11 - Diapositive

Cet élément n'a pas d'instructions

Practical Exercise: Serial.read() and Serial.write()
Equipment Needed:
Two Arduino boards (e.g., Arduino Uno)
Two USB cables for programming and power
Two LEDs and resistors (e.g., 220Ω) for indicating the received data
Jumper wires

Slide 12 - Diapositive

Cet élément n'a pas d'instructions

Practical Exercise: Serial.read() and Serial.write()

Slide 13 - Diapositive

Cet élément n'a pas d'instructions

Practical Exercise: Serial.read() and Serial.write()

Slide 14 - Diapositive

Cet élément n'a pas d'instructions

Practical Exercise: Serial.read() and Serial.write()

Slide 15 - Diapositive

Cet élément n'a pas d'instructions

Practical Exercise: Serial.read() and Serial.write()
Observation:

Open the Serial Monitor for both Arduino boards (Tools -> Serial Monitor).

Observe how the potentiometer data is transmitted from the first Arduino to the second Arduino, controlling the LED brightness based on the received values.

This exercise helps you practice using Serial.read() and Serial.write() for communication between Arduino boards. You can further modify and extend this exercise by experimenting with different sensors, adjusting the control logic, or adding more components.

Slide 16 - Diapositive

Cet élément n'a pas d'instructions

Introduction to analogRead
Arduino analogRead() is used to read analog voltage values from analog pins.

Slide 17 - Diapositive

Cet élément n'a pas d'instructions

Write down 3 things you learned in this lesson.

Slide 18 - Question ouverte

Have students enter three things they learned in this lesson. With this they can indicate their own learning efficiency of this lesson.
Write down 2 things you want to know more about.

Slide 19 - Question ouverte

Here, students enter two things they would like to know more about. This not only increases involvement, but also gives them more ownership.