Serial
Monitor
2024 to 2025
Objectives
1. Understand the functionality and relevance of SONAR sensors in robotics.
2. Connect and integrate a SONAR sensor and buzzer with an Arduino board.
3. Create a buzzer alert system that responds to objects within a specified range.
4. Construct a radar-like display system using LEDs to indicate object proximity.
1. Operators (5 mins)
- Teacher will ask & go over to all operators including joining operator
2. Serial Monitor & its uses (5 mins)
- Serial Monitor extension
- Coding for Serial monitor
3. Distance sensor ( 5 mins)
- Teacher will ask & revise about distance sensor
- Coding Distance sensor
4. Guided Practice 5 mins
- Teacher will write any student name on "serial monitor" to show students
5. Project time (25 mins)
- Students will do Task 3 by using Nested conditions
Any Guess??
1 2
Serial monitor
Dashboard displaying distance on
screen.
Communication extension for Serial Monitor
The Serial Monitor provides a way to send/receive information to/from
your Arduino code. You can use it to view data of any sensor
Serial Monitor
1. Serial monitor is located lower right side of pictoblox app.
2. The baud rate is a processing speed of data. We commonly
use 9600
3. Use communication extension to code & use serial monitor
SONAR terminals
Trig
Schematic Diagram
Arduino pin LED color
8 Red
9 Red
Arduino pin configuration
LEDs 10 Yellow
11 Yellow
12 Green
13 Green
5 Trig
4 Echo
SONAR 5V 5V
GND GND
2 Buzzer signal
Buzzer
Blocks Overview
Operators in programming
Used to create conditional statements and produce Boolean results before
moving on
1. Less Than:
2. Greater Than:
3. Equal To:
4. And:
5. Or: Not:
Joining operator is used to join two different terms or values
Joining operator
Distance sensor block
Distance sensor block calculate distance in cm. To use this block you need to select trig and echo pins same
as you connected with arduino
Trig
Conditions in programming
Conditions are basic “if, else” logic statements that modify how code is executed. Conditions are a key part
of the decision-making process for computers.
Example
Add operators and distance block here to compare or
check condition
Blocks
Example code
Nested Conditions
It means an if-else statement inside another if statement. Or in simple words
first, there is an outer if statement, and inside it another if – else statement is
present and such type of statement is known as nested if statement.
Add operators and distance block here to compare or
check condition
Blocks
Screenshot
● Press Shift + window+s keys together from
keyboard
● Save screenshot on desktop
● Turn-in
● Capture full screen along with
taskbar while taking screenshots of
your task otherwise there will be
zero scores for the task
1. Make your code in pictobox App and upload in robot to check.
2. Once you confirm your all tasks are working properly TURN IN for
evaluation.
Challenge:1 Display Distance on Serial monitor
Display distance with 1 second delay and baud rate 9600 on Pictoblox serial
monitor.
Serial Monitor
Guidelines:
1. Serial monitor is located lower right side of pictoblox app.
check slide: 5
2. Use communication extension to code & use serial monitor.
check slide: 5
3. Use joining operator. check slide: 10
4. Use distance sensor block. check slide: 12
5. Use loop to keep repeating the process
1. Make your code in pictobox App and upload in robot to check.
2. Once you confirm your all tasks are working properly TURN IN for evaluation.
Challenge:2 Converting distance
Convert distance from cm to Inch and display distance on serial panel in both cm
and inch
Hints Scale
1. Use arithmetic operators to calculate/ convert
distance
2. Use communication blocks to use serial panel
3. Use joining operator to join different terms.
4. Use distance sensor block to get data from
sensor
5. Use loop to keep repeating the operation
Output example