Lucky Mini Slot Machine
Are you going to throw a party lately? or going to a carnival? or just want to have fun with your kids? See if this mini slot machine can make your event much more fun!
This machine would choose a number itself and show the number on the screen. When people press the joystick, the number in the middle of the machine changes. When it changes to the number that is shown, a prize would come out.
If you like our projects and tutorials, you can follow us on Twitter, Facebook, and Youtube for more interesting STEM projects and ideas.
Supplies
Hardware
paperboard * 1
several LEGO bricks
3D printed reel * 1
Robotbit base *1
Robotbit Edu *1
18650 Lithium Battery *1
Future board *1
Software
Tool
Utility knife
scissors
ruler
pencil
double-side tape
3M tape
markers
3D printer
Idea
The slot machine is basically a cuboid, so we will use a piece of paperboard to cover the LEGO working parts and draw something on it to make it look like a real slot machine. The turning of the reel and the presentation of the prize require a servo.
The 3D Printed Reel
When finished printing, get rid of the extra parts, and write down the numbers with markers.
Assemble the Inner Part of the Machine
Assemble everything following the assembly instructions.
Design the Cover
Draw on the paperboard and cut out the parts we need.
Cover the Lego Framework With the Paperboard Cover
Use LEGO technic rubber stoppers to fix the cover to the LEGO parts.
Draw on the Cover!
Draw everything you like on the slot machine. We drew some patterns to make it looks more like a real slot machine.
Write the Program
We need to write the program to show a random number on the screen and make the reel turn to a random number and analyze whether the random number on the screen is the same as the one on the reel.
Write the Program: First Step - Set Variables
Set the x variable as the goal number (the number shown on the screen, and the reel needs to turn to this number to win); set the y variable as the reel number.
Write the Program: Second Step - to Analyze
To analyze whether x equals y. If so, then win the prize (the prize tray then extends); if not, then the game continues and nobody wins.
Write the Program: Third Step - Joystick Module
The triggering of the joystick changes the y variable. As y changes, the angle of the servo that controls the reel changes too. (the servo angles need to be adjusted before we write the program.)
Write the Program: Fourth Step - Indication
Add a boot animation to the beginning of the program.
Add the display of the goal number to the middle of the program. When the joystick is triggered once, the indication sound and image of not winning will be added to the program part that runs when not winning; same as the winning parts.
Now You Finish the Slot Machine!
Give it a go and have fun with your family and friends!