Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <ATX2.h>
- #include <PS2X_lib.h>
- #define PS2_DAT 24
- #define PS2_CMD 25
- #define PS2_SEL 26
- #define PS2_CLK 27
- PS2X ps2x ;
- void setup(){
- delay(1000);
- setTextSize(2);
- glcd(0,0,"Connecting");
- while(1){
- int error = ps2x.config_gamepad(PS2_CLK, PS2_CMD, PS2_SEL, PS2_DAT,0,0);
- if(error==0){
- glcd(0,0, "OK ");
- delay(1000);
- glcdClear();
- break;
- }
- delay(500);
- }
- }
- void loop(){
- ps2x.read_gamepad(0,0);
- if(ps2x.Button(PSB_CIRCLE)) {
- glcd(1, 1, "Circle ");
- }
- else if(ps2x.Button(PSB_CROSS)) {
- glcd(1, 1, "Cross ");
- }
- else if(ps2x.Button(PSB_SQUARE)) {
- glcd(1, 1, "Square ");
- }
- else if(ps2x.Button(PSB_TRIANGLE)){
- glcd(1, 1, "Triangle");
- }
- else {
- glcd(1, 1, " ");
- }
- delay(50);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement