drncx
January 29, 2016, 9:50am
1
Hi guys,
I want to present my beta version clone of Pacman Game for Arduino Due with ILI9341 tft and VGA lcd support with "ILI9341_due.h" and "VGA.h" libraries. Pacman is playable (with some glichies - because it is in develope state), there is 5 sample levels, you can use both outputs (VGA and ILI9341), controller (KEYPAD) is made from 8 buttons.
Used buttons:
START = Start or pause Game
SELECT = Reset Game
UP, DOWN, LEFT, RIGHT = Direction control
Source:
https://github.com/DrNCXCortex/Pacman-Arduino-Due
Video:
Pictures:
Pacman-Arduino-Due.zip (188 KB)
Okio
January 29, 2016, 9:53pm
2
Looks excellent, nice and smooth and not a hint of flicker. Not tried playing as I only 4 buttons, but cool nonetheless.
wilykat
February 1, 2016, 12:12am
3
Why not add NES controller library and use NES controller? It's got 4 direction, select, start, and 2 more buttons.
Or if Due can't handle any more libraries, use a 74595 serial to parallel shift register to decode NES data and feed 8 lines like the original button controller you have?
Subscribed!
drncx
February 1, 2016, 3:50am
4
OK I will try it. Give me some time...
drncx
February 1, 2016, 9:19am
5
OK, NES or SNES Controller is now working with Pacman Game, I used this: Google Code Archive - Long-term storage for Google Code Project Hosting. library (SNESpad 1.3 library for Arduino). And here is updated part code:
/******************************************************************************/
/* LIBRARIES INCLUDES */
/******************************************************************************/
//Library for SNESpad
#include "SNESpad.h"
// put your own strobe/clock/data pin numbers here
SNESpad nintendo = SNESpad(3,4,5);
/******************************************************************************/
/* Controll KEYPAD LOOP */
/******************************************************************************/
boolean but_START = false; //38
boolean but_SELECT = false; //40
boolean but_A = false; //44
boolean but_B = false; //42
boolean but_UP = false; //52
boolean but_DOWN = false; //50
boolean but_LEFT = false; //48
boolean but_RIGHT = false; //46
void ClearKeys() {
but_START=false;
but_SELECT=false;
but_A=false;
but_B=false;
but_UP=false;
but_DOWN=false;
but_LEFT=false;
but_RIGHT=false;
}
void KeyPadLoop(){
byte SNESpadState = nintendo.buttons();
Serial.println(SNESpadState);
if (SNESpadState & 8 || digitalRead(51)==0) { ClearKeys(); but_START=true; delay(300); } //else but_START=false;
if (SNESpadState & 4 || digitalRead(53)==0) { ClearKeys(); but_SELECT=true; delay(300); } else but_SELECT=false;
if (SNESpadState & 1 || digitalRead(44)==0) { ClearKeys(); but_A=true; } else but_A=false;
if (SNESpadState & 2 || digitalRead(49)==0) { ClearKeys(); but_B=true; } else but_B=false;
if (SNESpadState & 16 || digitalRead(52)==0) { ClearKeys(); but_UP=true; } //else but_UP=false;
if (SNESpadState & 32 || digitalRead(50)==0) { ClearKeys(); but_DOWN=true; } //else but_DOWN=false;
if (SNESpadState & 64 || digitalRead(48)==0) { ClearKeys(); but_LEFT=true; } // else but_LEFT=false;
if (SNESpadState & 128 || digitalRead(46)==0) { ClearKeys(); but_RIGHT=true; } //else but_RIGHT=false;
yield();
}
Pacman-Arduino-Due-NESPAD.zip (191 KB)