Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <ipst.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);
- motor(1,map(ps2x.Analog(PSS_LY),0,255,100,-100));
- motor(2,map(ps2x.Analog(PSS_RY),0,255,100,-100));
- delay(100);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement