Test pour PS2 sur MBED

Dependencies:   PS_PAD mbed

main.cpp

Committer:
potatojuice
Date:
2018-01-29
Revision:
0:49ebc8788d0a

File content as of revision 0:49ebc8788d0a:

#include "mbed.h"
#include <PS_PAD.h>
DigitalOut myled[] = {LED1, LED2, LED3};

PS_PAD DUALSHOCK(D11, D12, D13, D10);//PS_PAD (PinName mosi, PinName miso, PinName sck, PinName cs)
int main() {
    DUALSHOCK.init();
    while(1) {
        DUALSHOCK.poll();
        myled[0] = DUALSHOCK.read(DUALSHOCK.PAD_CIRCLE);
        myled[1] = DUALSHOCK.read(DUALSHOCK.PAD_SQUARE);
        myled[2] = DUALSHOCK.read(DUALSHOCK.PAD_TRIANGLE);
        //myled[3] = DUALSHOCK.read(DUALSHOCK.PAD_X);
        printf("RX=%d RY=%d LX=%d LY=%d\r\n",DUALSHOCK.read(DUALSHOCK.ANALOG_RX),DUALSHOCK.read(DUALSHOCK.ANALOG_RY),DUALSHOCK.read(DUALSHOCK.ANALOG_LX),DUALSHOCK.read(DUALSHOCK.ANALOG_LY)); 
        wait(0.02);
    }
}