M5Stack Projects: Mini Slot Machine Project With M5StickC Plus2

by OpenELAB in Circuits > Computers

262 Views, 0 Favorites, 0 Comments

M5Stack Projects: Mini Slot Machine Project With M5StickC Plus2

1280X1280 (2).PNG

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

precondition

Software dependency: Arduino IDE, VScode or text, etc. Hardware requirements: USB-C cable, M5StickC Plus2, etc. Dependencies: M5StickC Plus2 library, Arduino library, etc.

Installation of Dependencies

1.png
2.png
3.png
4.png
5.png
  1. After installing the Arduino IDE, open the Arduino settings, copy the M5 development board link [https://static-cdn.m5stack.com/resource/arduino/package_m5stack_index.json] to the arrow shown and click OK to save it.
  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.png
2.png
3.png
  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

1.png
2.png
3.png

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

4.png

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