关于后端:CST8227

49次阅读

共计 4670 个字符,预计需要花费 12 分钟才能阅读完成。

Instructions
Midterm Exam – Practical Question
Instructions
You are permitted (and encouraged) to reference all CST8227 course material hosted on Brightspace as well as your BYOD (for example, your solution to a previous lab).
I simply ask that you complete the practical question on your own — no help from your lab prof, no help from your friends nor the Internet other than the links provided in course materials.
Note: you are permitted to use the Internet to research on how to debounce a push-button switch. See below.
The Circuit and Serial Monitor
Use your Teensy to build a circuit that plays the Match Game. See below for the rules of the game.
Upon start-up, the initial state of the 7-segment display is continuously looping randomly picked digits (0 – 9) with a 500 mSec delay between each digit. As well, the Serial Monitor displays the current round number as:
Round #1…
An additional requirement is to display the following to the Serial Monitor each time the PBS is pressed: the PBS press #, and the frozen digit being displayed on the 7-segment display.
Follow this template for the Serial Monitor output:
PBS press # [1 | 2] ==> [frozen digit on the 7-segment display]
After the frozen digit is released, go back to continuously looping randomly picked digits (0 – 9) with a 500 mSec delay between each digit.
Upon the 2nd press of the PBS within a round, display whether or not the digit of the first PBS press equals the digit of the second PBS press.
If the digits match, display to the Serial Monitor:
==> MATCH
As well, blink the match-digit on the 7-segment display for 2-seconds to show a win.
If the digits don’t match, display to the Serial Monitor:
==> NO Match… period.
As well, display the decimal point on the 7-segment display for 2-seconds to indicate a loss.
Build of Materials (BoM)
Build your circuit using the following hardware components:
1 x Teensy v3.2 microcontroller
1 x USB cable (your own please)
1 x protoboard
1 x Shift Register (Texas Instruments)
1 x 7-Segment Display
1 x Push-Button Switch (PBS)
9 x 220-Ohm Resistors
o8 x 220-Ohm resistors for the 7-segment display; one resistor per 8 segments
o1 x 220-Ohm resistor for the PBS; configure in pull-down
Connection Wires
Software (SW) Requirements
Write, debug and test a Teensyarduino sketch that plays the Match Game. The rules of the game:
The game is played in rounds, and a round is defined as 2 presses of the push-button switch (PBS).
oDisplay the round number to the Serial Monitor: Round #N
At the start of a round, the 7-segment display is continuously looping randomly picked digits, 0 thru 9 (inclusive). Set the delay between each digit to 500 mSec.
When you press the PBS, freeze the digit on the 7-segment display for 2-seconds (2000 mSec).
oDisplay PBS press #1 to the Serial Monitor
When the digit un-freezes, go back to continuously looping randomly picked digits (0 – 9). Set the delay to 500 mSec.
When you press the PBS for the 2nd time in the round, freeze the digit on the 7-segment display for 2-seconds (2000 mSec).
oDisplay PBS press #2 to the Serial Monitor
Are the two digits — from PBS press #1 and #2 — the same? That’s a match!
oDisplay => MATCH to the Serial Monitor
oBlink the matched-digit for 2-seconds on the 7-segment display
Else, the two digits are not equal. That’s not a match.
oDisplay => NO Match… period. to the Serial Monitor
oDisplay the (right) decimal point for 2-seconds
Increment the round number, and display Round #2… to the Serial Monitor.
Repeat until game ends: when Teensy is powered off or player closes IDE & walks away.
Data Sheets
I made use of the following data sheets when making my solution:
7-segment Display:
oLDS-A504RI_7_Segment_Display.PDF
oLTS-7000.PDF (featuring 2 x decimal points (left & right))
Shift Register (Texas Instruments): sn7hc595.PDF
Download the Data Sheets from Brightspace: Content => Datasheets
References
1.Arduino Language Reference for random function: https://www.arduino.cc/refere…
Deliverables
Create a zip-file (must be zip please) that contains the following items:
1.Your sketch (.INO) file.
2.A video recording showing the running behaviour of your circuit.
1.Show me your circuit: do an ‘aerial’ shot, starting at the top of the circuit and move to the bottom. I expect to see the 7-segment display turned off, including the decimal point.
2.Show me one (1) round: Match
1.Show me the 7-segment Display: I need to see all digits (0 – 9)
2.Show me the Serial.Monitor
3.Show me one (1) round: No Match
1.Show me the 7-segment Display: I need to see all digits (0 – 9)
2.Show me the Serial.Monitor
3.A “selfie” with your prized circuit. Or, show me your Algonquin College Student ID card in the video recording of the previous step.
Upload and submit your zip-file to Brightspace before the due date.

Reference Screenshot: Serial Monitor Dialog
Assuming you debounced the PBS (see Rubric), your output in the Serial Monitor dialog window is to match mine exactly for full marks:

Rubic
A+ (10) :: plays Match Game and PBS is debounced using hardware xor the Bounce2 library (i.e. software)
ofor the library, I expect to see #include <Bounce2.h> at the top of your sketch (.INO) file
A (9) :: change the PBS to be in pull-up configuration with no discrete resistor. Make the appropriate change(s) to your sketch.
A- / B+ (8) :: Serial.Monitor output does not match reference screenshot (minor)
B (7) :: plays Match Game and PBS is debounced using millis() function
C (6) :: plays Match Game but PBS is not debounced
D (5) :: does not play Match Game
F (0) :: no deliverable

正文完
 0