Introduction
I recently came across a slot machine project using
M5StickC Plus and it piqued my interest. However, I only had the
M5StickC Plus2 at hand.
This got me thinking - could I create the same slot machine effect with the Plus2 and maybe even add some unique variations and optimizations? This seemed like the perfect opportunity to dive into this project!
The project involved an extensive exploration of the M5StickC Plus2, focusing on hardware control and graphic display. The decision was made to proceed with the mini slot project in a step-by-step manner, starting with an experiment.
Project Features
The objective of the project is to develop a mini version of a slot machine. Players will be able to activate the reels with a button and stop each column individually. The 1.14-inch TFT display included with Plus2 will be used to show five columns of scrolling icons, each containing 10 unique symbols. This setup aims to provide a visually rich and dynamic experience for the players.
Hardware Advantages of M5StickC Plus2
The M5StickC Plus2 offers significant performance enhancements in graphic display and hardware controls compared to the Plus version. Its controller enables users to initiate and terminate the spinning of reels, replicating the traditional slot machine experience. Hence, I have chosen to integrate it as the central hardware for the project. Leveraging its robust button interaction, players can effortlessly manage the game's start and stop functions. Furthermore, the display contributes to the project by enhancing image refresh speed and color performance.
Installation and Operation
2. Open Tools->Board->Boards Manager.
3. Search for M5Stack and choose to install it. It's already installed on this host, so I won't repeat the installation.
4. Select development version, Tools->Board->M5Stack Arduino->M5StickCPlus2.
5. Next, install the M5StickCPlus2 library, select Tools->Manage Libraries, search for M5StickCPlus2, and then select Install, which will not be repeated if it is already installed.
Compile and Run
1. After completing the installation of the dependencies, open the good downloaded zip archive.
2. Connect the Plus2 to your computer using USB-C, select Tools->Port to choose your own port.
3. Click on compile and then click on upload when the compilation is complete.
Instructions for Use
Order and Number of Pictures
The slot machine has five columns, each of which can hold up to 10 icons, and you can adjust their order at will!💡At the moment, we have prepared six 48x48 pixel material icons, their RGB565 hexadecimal data is already in the code, corresponding to elements 0 to 5 in the slot_symbols array. If you want to change the order and number of icons in each column, you can easily change the number in the symbolIndices array to change the display of the icons in each column!
Column-to-Column and Figure-to-Figure Spacing
By changing PAD_X and PAD_Y, you can change the spacing between columns and graphs, usually the default is 2 and 0.
Turntable Rotation Speed, Stop Reduction Speed
#define Speed_MAX 800 //Maximum speed of slot machine rotation
#define Speed_MIN 50 //Slot machine rotation minimum speed
#define Acceleration_MAX 12 //Acceleration when the slot machine is accelerating
#define Acceleration_MIN -20 //The acceleration when the slot machine is slowing down.
Next Issue Preview
In the next issue, we will explain in detail how to change the picture of the slot machine, we will get the hexadecimal parameters of the picture by taking the model of the picture and adjusting it to the format we want, and then present the picture we want on the slot machine Stay tuned!!!
More Details
M5Stack Projects: Mini Slot Machine Project with M5StickC Plus2 -2
3 Comments
If you encounter any issues along the way, feel free to check these links or contact us!
Project Specific Code: https://github.com/OpenELAB/OpenELAB-M5StickCPlus2-Slot
M5StickC_Plus_Slot_Machine: https://github.com/Sarah-C/M5StickC_Plus_Slot_Machine
M5Stack Projects: Mini Slot Machine Project with M5StickC Plus2 -2
https://openelab.io/blogs/learn/m5stack-projects-mini-slot-machine-project-with-m5stickc-plus2-2
https://openelab.io/blogs/learn/mini-slot-machine-project-with-m5stickc-plus2-3
When will the next issue be?