” 写作CST8227程序、 写作JavaInstructions Midterm Exam – Practical QuestionInstructionsYou 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 MonitorUse 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 #1An 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 dont 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 microcontroller1 x USB cable (your own please)1 x protoboard1 x Shift Register (Texas Instruments)1 x 7-Segment Display1 x Push-Button Switch (PBS)9 x 220-Ohm Resistorso8 x 220-Ohm resistors for the 7-segment display; one resistor per 8 segmentso1 x 220-Ohm resistor for the PBS; configure in pull-downConnection WiresSoftware (SW) RequirementsWrite, 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 #NAt 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 MonitorWhen 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 MonitorAre the two digits — from PBS press #1 and #2 — the same? Thats a match!oDisplay = **MATCH** to the Serial MonitoroBlink the matched-digit for 2-seconds on the 7-segment displayElse, the two digits are not equal. Thats not a match.oDisplay = NO Match period. to the Serial MonitoroDisplay the (right) decimal point for 2-secondsIncrement 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 SheetsI made use of the following data sheets When making my solution:7-segment Display:oLDS-A504RI_7_Segment_Display.PDFoLTS-7000.PDF (featuring 2 x decimal points (left right))Shift Register (Texas Instruments): sn7hc595.PDFDownload the Data Sheets from Brightspace: Content = DatasheetsReferences1.Arduino Language Reference for random function: httpss://www.arduino.cc/reference/en/language/functions/random-numbers/random/DeliverablesCreate 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: Match1.Show me the 7-segment Display: I Need to see all digits (0 – 9)2.Show me the Serial.Monitor3.Show me one (1) round: No Match1.Show me the 7-segment Display: I need to see all digits (0 – 9)2.Show me the Serial.Monitor3.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 DialogAssuming you debounced the PBS (see Rubric), your output in the Serial Monitor dialog window is to match mine exactly for full marks:RubicA+ (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) fileA (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() functionC (6) :: plays Match Game but PBS is not debouncedD (5) :: does not play Match GameF (0) :: no Deliverable如有需要,请加QQ:99515681 或WX:codehelp
“
添加老师微信回复‘’官网 辅导‘’获取专业老师帮助,或点击联系老师1对1在线指导。