//imports the library #include "PSP-Nx-v4-lib.nxc" //Defines receiver module address for I2C communication #define ADDR 0x02 //Defines input port as 1 (change as seen fit) const byte SensorPort = IN_1; task main(){ //Initializes variables associated with button/stick inputs psp currState; psp pressures; //Initializes PS2 controller connection PSPV4_Init(SensorPort, ADDR); while(true) { //continuously reads controller button and stick values PSPV4_ReadButtonStateWithPressure(SensorPort, ADDR, currState, pressures); //Puts current state of left joystick ranged [-100:100] into integer variable int leftStick = currState.l_j_y; //Move motor forward based on leftStick value OnFwd(OUT_A, leftStick); } }