Pastebin

ps2x

ps2x from Pastebin

Ps2x Pastebin Ps2xc paste Ps2x2 details Ps2xpc code Ps2x_lib.h snippet Ps2xe text Ps2x library source Ps2x110-33 sharing Ps2xray2 script Ps2 emulator public Ps2x arduino private Ps2x110-30 document Ps
    
        #include  	
int LX,LY,RX,RY;
#include  	
#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);
}