When I bought a 800 x 480 IPS Touchscreen shield (Model MAR4018) for the Mega I was amazed at the Quality of the Screen. I was showing Pics in a slideshow at first and the Image quality was fantastic. I eventually decided I wanted to make a Full on Graphical Poker game for it. I used Very detailed Playing cards and used the Micro SD card on the Touchscreen to store them. All the BMP's are Converted to 16 Bit 565 Color to reduce the loading times.
The game should be easy to get running if you use the same hardware. You need to use a Mega as the game needs the extra ram. (Used for fast BMP loading.) You need an 800x480 screen as the game has been written for that resolution.
Just copy the 53 BMP's to a Micro SD Card and insert it into the Screens SD Slot. Compile the sketch and program the Mega. It should run.
The Game is very simple to use. It prompts the User for what to do. Deal, Hold, Shuffle etc. It's all Touch driven.
One thing I found out when writing this project. The LCDWIKI_Touch driver does NOT work with the Micro SD card in use. The SD card driver uses Hardware SPI but the LCDWIKI_Touch driver uses Software SPI. The Touch won't work after the SD card driver is initialised. I did however find a Touchscreen driver that does use Hardware SPI. You do need to use this driver. Thanks to Paul Stoffregen for releasing it. It's available on Github at
I am using the LCDWIKI NT35510 Screen driver. The model of the Touchscreen is MAR4018. It's exceptional value for money. It's a true IPS screen unlike the others in this size range which are TFT.
Link to the Library for the 4 Inch Screen on the LCDWIKI Web Page.
I have updated the code to use the SdFat Library to access the SD Card. That Library is about double the reading speed of the old SD Library. You will need to install the SdFat Library from the Library Manager in IDE.
I did have some issues with SdFat as it's not fully compatible with the SD Library. It is working now though. It display all 5 cards in about 1.5 Seconds.
17th November 2022: Major Update
The MAR4018 is a Very nice IPS screen. The Colours are vibrant and the contrast is great. HOWEVER, The Touch panel they have used is VERY Poor quality. The Screen on mine has noticeable Rotation Errors and "Severe" Linearity Errors. The Linearity was so bad I had to calibrate every button position manually. The standard Touch Screen Calibration methods do not work.
I have added Calibration code to the Sketch as well as a Test Calibration code. See the Read_Me file on Calibration etc.
EXPANDED TECHNICAL DETAILS
Game Logic & State Machine
This project implements a single-player Draw Poker game on an Arduino.
- Deck Management: The firmware uses an array to represent the 52-card deck. A randomization function (seeded via an open analog pin) shuffles the deck at the start of each round.
- Card Selection: The player interacts with pushbuttons to "Hold" or "Discard" cards from their initial 5-card hand. The game's state machine transitions from "Deal" to "Hold" to "Draw" and finally to "Evaluate."
Evaluation Engine
The Arduino performs complex pattern matching to identify winning hands:
- Hand Ranking: It checks for pairs, three-of-a-kind, straights, flushes, and the coveted Royal Flush.
- Visual Display: Results are shown on an LCD or an OLED display, with text-based representations (e.g., "KH" for King of Hearts). The score is tracked and updated based on the rarity of the hand achieved, providing a portable, low-power casino gaming experience.