Documente Academic
Documente Profesional
Documente Cultură
LCD
pins
Program
<LiquidCrystal.h>
- Library that allows an Arduino board to control LiquidCrystal displays (LCDs) based on the Hitachi
HD44780
begin()
-LCD function that specifies the dimensions (width and height) of the display.
clear()
LCD function that clears the LCD screen and positions the cursor in the upper-left corner
home()
LCD function that positions the cursor in the upper-left of the LCD.
lcd-myLCD.setCursor(col_pos, row_pos);
- LCD function that position the LCD cursor; that is, set the location at which subsequent text written to
the LCD will be displayed.
lcd-name.scrollDisplayLeft(); - Scrolls the contents of the display (text and cursor) one space to the left.
lcd-name.leftToRight() - Set the direction for text written to the LCD to left-to-right, the default
lcd-name.createChar(num, data) - Create a custom character (glyph) for use on the LCD. Up to eight
characters of 5x8 pixels are supported (numbered 0 to 7).
KEYPAD
is a contributed library that supports programming for matrix style keypads with the Arduino
makeKeymap(user-key-map)- A keypad function use to initializes the internal keymap to be equal to user-
defined keypad map
keypad-name.getKey(); - A keypad function use to returns the key that is pressed, if any. This function is
non-blocking.
getState(). A keypad function that returns the current state of any of the keys.
keyStateChanged(). A keypad function use to determine when the key has changed from one state to
another.
setHoldTime(). A keypad function that sets the amount of milliseconds the user will have to hold a button
until the HOLD state is triggered.
setDebounceTime(). A keypad function use set the amount of milliseconds the keypad will wait until it
accepts a new keypress/keyEvent.
PASSWORD
set(). A password function use to set the target password equal to user-password.
is(). A password function use to test if the target password is equal to user-password.
append(). A password function use to append a character to the currently guessed password.
evaluate(). A password function use to guessed user-password is equal to the target password.
RTC
DS1307 RTC
DateTime. A RTC constructor function use to instantiate date and time object or variable.
Syntax: rtc-name.begin();
now(). A RTC function use extract the current date and time from DS1307 chip.
month(). A RTC function use extract the current month in integer format.
day(). A RTC function use extract the current day in integer format.
year(). A RTC function use extract the current year in integer format.
hour(). A RTC function use extract the current hour in integer format.
minute(). A RTC function use extract the current minute in integer format.
second(). A RTC function use extract the current second in integer format.
PART 2
Servo Motors
-0 to 180 degrees.
-closed loop
-small size
-electrically efficient
-Servo library supports up to 12 motors on most Arduino boards and 48 on the Arduino Mega.
-On the Mega, up to 12 servos can be used without interfering with PWM functionality;
1.5ms = 90 degrees
write(). A servo function use writes a value (angle) to the Servo, controlling the shaft accordingly.
writeMicroseconds(). A Servo function use writes a value in microseconds (us) to the servo, controlling
the shaft accordingly.
attached(). A Servo function use to check whether the Servo variable is attached to a pin.
detach(). A Servo function use to detach the Servo variable from its pin.
SoftPWM Library
- An Arduino and Wiring Library to produce PWM signals on any arbitrary pin.
SoftPWMBegin(). A SoftPWM function use to initializes the library and sets up the timer and other tasks
SoftPWMSet(). A SoftPWM function use to set pin use as PWM output pin and value between 0 and 255
SoftPWMSetPercent(). A SoftPWM function use to write duty cycle percentage between 0 and 100
(inclusive) in clone-pwm-pin.
SoftPWMSetFadeTime(). A SoftPWM function use configure fade up and fade down time in a clone-pwm-
pin.
fade-up-time is the time in milliseconds that it will take the channel to fade from 0 to 255 having a range
of 0 to 4000 ms
Stepper Motor
-open-loop operation
-TYPES
-Full Stepping
-Half Stepping
-0.9 degrees/step.
-Micro Stepping
2 inputs for the motors voltage source (up to 50v, 10A, ground)
PROGRAM
Stepper(). A function that creates a new instance of the Stepper class that represents a particular stepper
motor attached to Arduino board.
setSpeed(). A function use to set the stepper motor speed in rotations per minute (RPMs)
step(). A function use to turn the motor a specific number of steps, at a speed determined by the most
recent call to setSpeed().
For better control, keep the speed high and only go a few steps with each call to step().
PART 3
-are small, inexpensive, low power, rugged, have a wide lens range
Ultrasonic Sensor
FORMULAS
S=Vxt
s= distance
V= velocity
T= time
reciprocal
-are defined as electronic devices that emit an acoustic wave beyond the upper range of human hearing
- called the audible range
-determine the distance between the sensor and an object based on the time it takes to send the signal
and receive the echo
-frequency increases the sound waves transmit for progressively shorter distances.
APPLICATIONS
-alarms
-medical ultrasounds
-distance measurement
GPS
-TinyGPS
- is designed to provide most of the NMEA GPS functionality with Arduino to determine the current
position, date, time, altitude
-does not handle retrieving serial data from a GPS unit. When encode() returns “true”, a valid sentence
has just changed the TinyGPS object’s internal state.
PROGRAM
encode(). A function use to feed the object serial NMEA data one character at a time.
get_position(). A function use to extract or query the GPS longitude, latitude, and altitude.
get_datetime(). A function use to extract or query the GPS current date and time.
get_datetime(). A function use to extract or query the GPS current date and time.
stats(). A function use to provides statistics that help with troubleshooting with GPS.
chars - the number of characters fed to the object
For applications which are not resource constrained, it may be more convenient to use floating-point
numbers.
3.The NMEA sentences must report valid data. If the $GPRMC sentence reports a validity of “V” (void)
instead of “A” (active), or if the $GPGGA sentence reports fix type “0? (no fix) then those sentences are
discarded.
To test whether the TinyGPS object contains valid fix data pass the address of an unsigned long variable
for the “fix_age” parameter in the methods that support it.
To know the object has never received a valid fix use TinyGPS::GPS_INVALID_AGE.
To know the object has never received a valid fix use TinyGPS::GPS_INVALID_AGE.
If your NMEA data is coming from a serial GPS unit, connect it to Arduino’s hardware:
-is the latest of three Arduino libraries providing “soft” serial port support. It’s the direct descendant of
ladyada’s
In this example, we assume that read_gps_data() uses the gps object and read_thermometer_data() uses
the therm object. Any time you call the listen() method, it becomes the “active” object, and the previously
active object is deactivated and its RX buffer discarded. An important point here is that object.available()
always returns 0 unless object is already active.