Mbed Poker

Mbed Poker

Creators: William Jenkins, G. Sunayana

Description

Mbed Poker is a Texas Hold'em poker game implemented on two Mbed LPC1768's. Each Mbed has two Nokia LCD Display's and two mpr121 capacitive touch sensor's. The main code for Texas Hold'em is modular and will allow for more players and mbeds if connected together. In our project we used serial to connect our two mbeds but other methods are possible with small changes to functions in the code. Each player has a Nokia LCD screen and a keypad to enter the amount to bet/call/fold/check etc. Up to 2 players can be supported on each Mbed. The number of players is limited by the number of I2C buses for the keypads. The primary Mbed has a third LCD that is used as the dealer LCD screen.

The mapping of the keypad buttons has been changed for user's convenience. The numbering is done left to right instead of bottom to top starting from 3 i.e. the button numbered as '3' will be taken as input of the digit 1 by the program. The button numbered as 1 will be taken as a 0. Those numbered as 0 and 8 are 'Call' and 'Fold' respectively. Either of them can be used to 'Check'.

Each player's screen displays the current wallet amount and the 2 cards that belong to the player. They are in the format 'face' 'suit'. Eg: If the display shows 10 H followed by K D, the player has a 10 of Hearts and a King of Diamonds. The characters on the display screens are also color coded so that the cards belonging to the hearts/diamonds suit are in red and those belonging to spade/club are shown in black. The dealer's screen displays the current pot amount, the current player and a list of the common cards. This screen gets updated continuously as the game progresses. All of the screens are reset when a new round begins or when the game is restarted.

The code for this game is available in two main files which will be described later.

Parts

Pin Connections

The only difference between the connections in primary and secondary mbed is the primary has the extra LCD used for the dealer screen. The Keypad SDA and SCL pins need to have a pull-up resistor a 4.7k worked fine for us. The two mbeds are connected using serial pins. An external power supply is required for both the Mbeds to power the screens on each Mbed.

Mbed PinLCD1LCD2LCD3keypad1keypad2
VOUTVbatt, 3.3VVbatt, 3.3VVbatt, 3.3VVCCVCC
GNDGNDGNDGNDGNDGND
P5DIODIODIO
P7SCKSCKSCK
P8CS
P9SDA
P10SCL
P15RST
P16CS
P17RST
P18CS
P19RST
P27SCL
P28SDA

The two mbeds are connected together using a serial connection.

Mbed1Mbed2
P14P15
P15P14

Code

Interfacing

The basic APIs for the Nokia LCD screens and MPR121 keypads used to develop the code for this project can be found at:

http://mbed.org/users/4180_1/code/MPR121_Demo/ http://mbed.org/components/Nokia-LCD-Display/

Primary Mbed

The primary Mbed takes the number of players, starting amount of each player and blinds as the input from Keypad of player 1. The game then progresses and the winner is determined for each hand. The winner's amount gets updated as required.

http://mbed.org/users/wjenkins7/code/Mbed_Poker_Primary/

Secondary Mbed

The secondary Mbed just takes inputs from players 3 and 4 and sends data using serial to the primary Mbed. The primary Mbed notifies the secondary Mbed with the result at the end of every hand. The players on the secondary are updated with their total amounts every round.

http://mbed.org/users/wjenkins7/code/Mbed_Poker_Secondary/

Video

Images

Dealer's Screen:

/media/uploads/wjenkins7/20131210_164304.jpg

Player's Screen:

/media/uploads/wjenkins7/20131210_164343.jpg

Future Developments

  • Use ethernet or IR to communicate between the two Mbeds or more Mbeds
  • Use a different screen and read from an SD card to display better graphics on each player's screen and the dealer's screen


Please log in to post comments.