Embedded Systems
Assignment 4
Casino Gamble Machine
Required equipment
Arduino UnoUSB cable
Open SmartRich Shield
Laptop PC
Introduction
In this assignment you will make a casino gambling machine with the Arduino Uno and the rich shield. Its a realtime game in which you demonstrate the programming techniques you have learned in the previous weeks. The focus of this assignment is on fast and timed animation of the display and the responsiveness of the buttons.
You have to implement one of two gambling machines:
Roulette. All four digits of the display are used. The segments of the digits simulate the rotation of the roulette wheel. Each step shifts the segment as if the wheel rotates.
Wheel of Fortune. All four digits of the display are used. Four subsequent numbers of cyclic list of numbers 0123456789 are shown on the display. After 9 the next digit is 0. Each step shifts the numbers to the right as if the wheel rotates. The second digit is the target digit.
A demonstration will be given by the teacher of these two casino gambling machines. It is up to you what casino gambling machine you will be implementing. These system description below applies to both casino gambling machines.
System description
The casino gambling machine uses the components of the rich shield. The display depicts the game and the two buttons are used to setup the game.
The following requirements of the casino gambling machine apply to both gambling machines:
The player uses one button to set the target before the game can start.
For the roulette, the player can set the target segment of the wheel by clicking this button multiple times. Each click is a step of the wheel.
For Wheel of Fortune, the player can set the target number of the wheel by clicking this button multiple times. Each click is a step of the wheel.
The player uses the other button to start the game after the target has been set by the player.
The players can set a new target after the previous game has ended.
While the game is running wheel is spinning the buttons are disabled and a short beep is given when pressing the buttons.
The game starts with spinning the wheel at high speed for some short amount of time e.g. 3 seconds and then it spins slowly down until the wheel stops approx.. 5 seconds.
While the wheel spins, a sound should be produced proportional to the speed of the wheel.
When the wheel stops, the game determines whether the player as won or loss. If the wheel stops at the target set by the user then the player wins, otherwise the player loses. The display blinks YEAH or LOSS and with different sounds for each result for a short amount of time.
The buttons and sounds should not visibly influent the speed of the game.
A working program is sufficient. You can get a higher indication if you demonstrate any to all of the following proramming concepts.
Arrays for the animating of the wheel.
Use the loop function for the main loop and use forloops for smaller inner loops.
Debouncing solution for all buttons.
Use millis instead of delay to make the game responsive.
Use sequence state patterns state machine to distinguish between the different behaviours statesmodes of the game.
Use functions to make code structured and better readable.
Demonstrate the game. Show the performance and responsiveness of the game. Be creative and dress the game such that it becomes an attractive casino gambling machine; use blinking LEDs and sounds. Dont forget to document your code and refactor rework your code to make it highly maintainable.
Reviews
There are no reviews yet.