CP316: Microprocessor Systems and Interfacing
LCD shield and serial monitor
Background
This lab will introduce simple ways to provide user interaction with
an Arduino.
Objectives
- To produce output to an LCD display and get input from
switches.
- To use the serial monitor for user input and output.
Equipment
- Arduino Uno board
- Linksprite LCD display shield
- oscilloscope
Procedure
Setup
- Attach the LCD
shield to the Arduino.
- Reconnect the USB cable
- Create a new sketch using the sample
code provided.
Demonstrate the program working.
- Pin D10 is used by the shield to control the backlight.
Connect the pin to GROUND to see the effect.
Modify your sketch by making pin 10 an output, and when the
"Down" key is pressed make it LOW, and when the "UP" key is
pressed, make it HIGH. (See the Blink sketch for examples of how
to make a pin HIGH or LOW.)
Demonstrate the program working.
Shield control and display of timer
- Now combine the code with one of your PWM sketches from before
where the
frequency was controlled by OCnA. (If you need to adapt it for a
different timer because of pins used by the display shield, do
so.)
- Connect the oscilloscope to the output pin used by the
timer.
- Adapt the code so that the UP and DOWN buttons increase and
decrease the frequency, and RIGHT and LEFT buttons increase and
decrease the duty cycle. Make the SELECT button cycle through
the various prescaler options. Toggle the backlight each time
the prescaler changes.
Display the frequency and duty cycle on the LCD as well.
Demonstrate the program working.
Serial monitor control and display of timer
- Now add code to mirror the LCD display on the serial monitor;
i.e. send whatever you display to the serial monitor as well.
- Now adapt the code to take input from the serial monitor as
well.Specifically, have one key turn on the backlight and another
turn it off.
Demonstrate the program working.
Wilfrid Laurier University
© 2019 Wilfrid Laurier University