Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <ATX2.h>
- int LX,LY,RX,RY;
- #include <PS2X_lib.h>
- #define PS2_DAT 30
- #define PS2_CMD 29
- #define PS2_SEL 28
- #define PS2_CLK 27
- PS2X ps2x ;
- void setup(){
- delay(1000);
- setTextSize(2); glcd(0,0,"Connecting");
- while(true){
- 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);
- LX=ps2x.Analog(PSS_LX); glcd(0,0,"LX=%d ",LX);
- RX=ps2x.Analog(PSS_RX); glcd(1,0,"RX=%d ",RX);
- LY=ps2x.Analog(PSS_LY); glcd(2,0,"LY=%d ",LY);
- RY=ps2x.Analog(PSS_RY); glcd(3,0,"RY=%d ",RY);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement