Mr BILLINGTON
>Keypad Programming<
1.Initially the random numbers are generated and stored on VARIABLE A & B.
2.The question in generated from these on the LCD output
3.The correct answer & two wrong answers are calculated and stored as C, D & E
4. Answer - The display order of the answers are randomized using VARIABLE F
5.User response is recorded using input D6 (a) D7 (b) & D2 (c) and stored as variable G
6.Answer is checked using the random order variable F and response G
7.Answer is determined CORRECT or INCORRECT increasing question number variable 'H' and playing a tone
8.If H is less than 0, H is not decreased
Using Circuit Wizard allows you to write and test programs virtually using Genie microcontrollers. The 'E18 Activity Board' is ideal for practicing the use of flowchart programming as it has a range of inputs and outputs that can be controlled.
As shown, the addition of a push-to-make on A/D2 & an LCD on Q7 allows for greater creativity. The 'serial' (middle) wire for the LCD can be connected to the positive of the LED on Q0, as it is a serial output on the E18. This setup is ideal for a range of program ideas
----------------------------------------------------------------------------------
Reaction Game -
This program is designed as a simple reaction/speed game whereby the user must press a button (D7) as quickly as possible within 5000ms (5s). If the user achieves a HIGH SCORE then they are rewarded with flashing LED's and sound
The game has a traffic light LED countdown and a 'GO' message to start. The microcontoller counts the input signals received to 'D7' within a given time frame. The number is stored initially as 'VARIABLE A' & compared to B. If A>B the user is notified of a high score
This game can quickly be adjusted for different time limits and additional inputs could be added for greater complexity. The reward/high score could equally be anything the user required and adjusted easily
This can also be adapted into a 'Splat the Rat' style game
----------------------------------------------------------------------------------
Addition Game -
This program is a far more complex game which requires the user to add two randomly generated numbers together and choose answer A, B or C
Systems approach to Designing - Program Examples
Copyright © A.F.Billington 2022. All rights reserved.