Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: THEend8_
LAB 7 Page 1
LAB 7: Using the GROVE 4 Digit Display & PIR Motion Detector
LAB SECTION: A B C D E F G H I J K L M N O P
OBJECTIVES:
1. To be able to import the 4 DIGIT DISPLAY library from the COMPONENTS section
of MBED HARDWARE. The 4-digit display should be connected to D2 on the Grove Shield.
2. To be able to use in your programs, the CLASS MEMBER Functions:
DigitDisplay(), on(), off(), setBrightness(), setColon(), write(int16_t n),
write(uint8_t numbers[]), write(uint8_t position, uint8_t number),
writeRaw(uint8_t segments[]), writeRaw(uint8_t position, uint8_t segments), clear() .
3. To be able to create scrolling messages on the 4 digit display using the writeRaw Function.
4. To be able to combine the POT to manipulate Brightness or starting value on the 4 Digit Display.
5. To be able to use the LEFT PUSHBUTTON to START the count.
6. To be able to display temperature on the 4 digit display.
7. To mix text and data on 4 digit display using write and writeRaw.
8. To use the PIR Motion Detector to Trigger an Interrupt. The PIR Motion Detector should be
connected to D6 on the Grove Shield.
Procedure:
1. CLICK HERE to import a program into the MBED compiler which demonstrates the DigitDisplay
Public Member Functions.
2. After Watching THIS VIDEO, understand how to make the number 5432 show up on your 4 digit
display.
3. After Watching THIS VIDEO, understand how you can use the POT to change the brightness
of the 4 digit display and to also display the value of brightness on the display.
4. After Watching THIS VIDEO, understand how to use the POT to set a time from
00:00 to 90:00 until you hit the Left Pushbutton and then when it reaches 0, how to display 0 0 0 0
on the 4 digit display.
5. After Watching THIS VIDEO, ADD to the program of Procedure 4 above so that when it reaches
0 , it scrolls the message as shown on the video, and flashes the LCD continuously from BLACK to
White.
LAB 7 Page 2
6. Create a program that will take readings from the Temperature Sensor, and display these readings
in both Celsius and Fahrenheit, on the LCD, 4 digit display and PC Screen.
Your output should look like this.
NOTES: 1. In Lab 6 there is a program that you can clone that has the temperature and
Pot readings going to the LCD display. This has a lot of the code that you will
need and some parts you have to get rid of.
2. To convert Celsius to Fahrenheit, you can use the formula:
F = (9.0/5.0) * C +32.0 ;
3. To display both temperatures on the 4 Digit Display, you can use:
temp = (int) C * 100 + (int) F;
(where temp is an int, then you can use segs.write(temp) ; )
(You need to have the integer values of both C and F)
4. You should turn on the COLON on the 4 digit display.
5. The brightness value should be 4 .
7. CLICK HERE to import a program into the MBED compiler that will turn the LCD to RED
every time that motion is detected by the PIR MOTION DETECTOR.
8. Modify the program in STEP 6 that it will ALSO turn the LCD RED when motion is detected as it
is updating the temperature in Celsius and Fahrenheit.