Remodeling Xbox Wireless controller with mbed LPC1768

Dependencies:   ACM1602NI mbed

main.cpp

Committer:
eil4nyqn
Date:
2016-01-22
Revision:
0:a44e054c96e8

File content as of revision 0:a44e054c96e8:

#include "mbed.h"
#include "ACM1602NI.h"


ACM1602NI lcd(p28,p27);
BusIn XYAB(p5,p6,p7,p8);
BusIn cross(p9,p10,p11,p12);
AnalogIn left(p15);
AnalogIn Right(p17);
AnalogIn RH(p18);
AnalogIn LH(p16);
//JST = Joy Stick TactSW
BusIn JST(p23,p24);
BusIn SB(p29,p30);
BusIn other(p21,p22);
AnalogIn LT(p20);
AnalogIn RT(p19);
DigitalOut led(p26);
DigitalOut led2(p25);
Serial con(p13,p14);

int main() {
    XYAB.mode(PullUp);
    other.mode(PullUp);
    SB.mode(PullUp);
    JST.mode(PullUp);
    cross.mode(PullUp);
    uint8_t i,n,m,p,q;
    double z,x,c,v,g,j;
    
    char data=0,check=255;
    
    //lcd.printf("Start\n");
    //wait(2);
    
    while(1) {
        i = XYAB;
        n = cross;
        m = JST;
        p = SB;
        q = other;
        
        z = left;
        x = Right;
        c = LT;
        v = RT;
        g = RH;
        j = LH;
        
        led = 1;
        led2 = 1;
        
        data=p;
        
        con.putc(check);
        con.putc(data);
        
        
        printf("%d-%d-%d-%d-%d--%lf-%lf-%lf-%lf-%lf-%lf\r\n",i,n,m,p,q,z,x,c,v,j,g);
    }
}