Mastering Arduino Serial Communication

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

In deze les zitten 19 slides, met interactieve quizzen en tekstslides.

time-iconLesduur is: 60 min

Onderdelen in deze les

Mastering Arduino Serial Communication

Slide 1 - Tekstslide

Deze slide heeft geen instructies

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

Slide 2 - Tekstslide

Deze slide heeft geen instructies

Text
What do you already know about Arduino Serial communication?

Slide 3 - Woordweb

Deze slide heeft geen instructies

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

Slide 4 - Tekstslide

Deze slide heeft geen instructies

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

Slide 5 - Tekstslide

Deze slide heeft geen instructies

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


Slide 6 - Tekstslide

Deze slide heeft geen instructies

Practical Example: Serial.print()

Slide 7 - Tekstslide

Deze slide heeft geen instructies

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

Slide 8 - Tekstslide

Deze slide heeft geen instructies

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 - Tekstslide

Deze slide heeft geen instructies

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 - Tekstslide

Deze slide heeft geen instructies

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

Slide 11 - Tekstslide

Deze slide heeft geen instructies

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 - Tekstslide

Deze slide heeft geen instructies

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

Slide 13 - Tekstslide

Deze slide heeft geen instructies

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

Slide 14 - Tekstslide

Deze slide heeft geen instructies

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

Slide 15 - Tekstslide

Deze slide heeft geen instructies

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 - Tekstslide

Deze slide heeft geen instructies

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

Slide 17 - Tekstslide

Deze slide heeft geen instructies

Write down 3 things you learned in this lesson.

Slide 18 - Open vraag

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 - Open vraag

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