Sunteți pe pagina 1din 3

LCD:

An LCD is a liquid-crystal display. It is a board that can display 32 different characters in


it 2 rows and 16 columns. To let the LCD work, you must include the library that contains all the
code to allow the arduino program to recognize LCD commands (#include <LiquidCrystal.h>).
The first command is initializing the LCD (LiquidCrystal lcd(rs, en, d4, d5, d6, d7);). Next, the
number of rows and columns within the LCD must be chosen (lcd.begin(16,2);). The setCursor
command sets where the characters will be printed exactly on the LCD
(lcd.setCursor(column(0-15),row(0-1));). The blink command lets the desired slot on the LCD to
blink (lcd.blink();). Finally, the print command puts text onto the LCD (lcd.print();). Finally, the
clear command wipes the LCD of all text and characters (lcd.clear();).

In a serial monitor, the text and information that is printed into it must be seen on a
computer. While this is useful if a computer is readily available, this can not always work. If the
arduino is connected to an external power source and a computer is not attached, then no
information can be seen. This is when the LCD becomes useful as it can display information
when only connected to a power source. The LCD does have its limitations because it can only
display a certain number of characters
There were some challenges while using the LCD with an arduino. The LCD was hard to
connect to the arduino as it has a lost of wires and needed to be imputed into many different
digital pins. Additionally, initializing from LiquidCrystal was hard as you had to make sure the
ports in the code lined up with the actual hardware.

Ultrasonic Sensor:
An ultrasonic sensor is a device that measures distance by sending sound waves. It
works by sending pulses of sound out of one part of the device, and then it senses how long it
takes for that wave to get back to the device after hitting an object. The trig pin is the part of the
sensor that sends the sound waves out while the echo pin is the part of the sensor that receives
the sent out sound waves.
There are a couple main commands to use for the ultrasonic sensor. First, the trigPin
must be set to sound out information (pinMode(trigPin,OUTPUT);) while the echoPin must me
set to receive input from the trigPin(pinMode(echoPin,INPUT);). Next, the arduino must tell the
trigPin when to send out the pulses(digitalWrite(trigPin,LOW/HIGH);). The trig pin needs to be
switch from off(low) to on(high) to off(low). In between each of these, a delay is necessary to
allow the sensor to work properly. Turning the trigPin on and off causes it to pulse, which allows
the echoPin to receive the pulses and find out the time it takes for the sound wave to travel back
to the echoPin.

The ultrasonic sensor behaves differently on different surfaces: On flat surfaces, he


sensor works as the sound travels to the surface and bounces straight back as it is
perpendicular to the sensor. However, if the sensor it too close to the surface, the information
will be wrong as all the sound bounces back too fast. However, on curves or angles surfaces,
the sound will not bounce straight back and the information will be skewed because the surface
is not perpendicular to the sensor. Curved surfaces will send some sound back to the sensor,
but it will not be the path of shortest distance (straight there and back)

S-ar putea să vă placă și