EasyManua.ls Logo

Keyestudio 4DOF - Page 225

Keyestudio 4DOF
276 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
222
if(ps2x.Button(PSB_L1) || ps2x.Button(PSB_R1)) { //print stick values if either is TRUE
Serial.print("Stick Values:");
Serial.print(ps2x.Analog(PSS_LY), DEC); //Left stick, Y axis. Other options: LX, RY, RX
Serial.print(",");
Serial.print(ps2x.Analog(PSS_LX), DEC);
Serial.print(",");
Serial.print(ps2x.Analog(PSS_RY), DEC);
Serial.print(",");
Serial.println(ps2x.Analog(PSS_RX), DEC);
}
}
delay(50);
}
******************************************************************************************************************************
Test Result:
Stack the drive shield onto UNO R3 and upload the code. Connecting the PS2 Joypad, open the serial monitor and
set the baud rate to 57600. When press down the key or push the rocker, you should see the corresponding
character showed on the monitor.

Related product manuals