Norbert S / Mbed 2 deprecated joykey

Dependencies:   mbed

Committer:
norberts
Date:
Sun Aug 28 14:37:47 2011 +0000
Revision:
0:207850946233
Child:
1:afc3bf972645
initial, sends ijkm<sp> on atari joystick movements

Who changed what in which revision?

UserRevisionLine numberNew contents of line
norberts 0:207850946233 1 #include "mbed.h"
norberts 0:207850946233 2 #include "usbhid.h"
norberts 0:207850946233 3
norberts 0:207850946233 4 DigitalOut l1(LED1),l2(LED2);
norberts 0:207850946233 5
norberts 0:207850946233 6 Serial pc(USBTX, USBRX); // tx, rx
norberts 0:207850946233 7 BusIn bus(p21,p22,p23,p24,p25);
norberts 0:207850946233 8 usbhid usb;
norberts 0:207850946233 9
norberts 0:207850946233 10 int main()
norberts 0:207850946233 11 {
norberts 0:207850946233 12 int i=0,j;
norberts 0:207850946233 13
norberts 0:207850946233 14 pc.printf("I live! Again ...\r");
norberts 0:207850946233 15 usb.keyboard("rem ");
norberts 0:207850946233 16
norberts 0:207850946233 17 while(1){
norberts 0:207850946233 18 wait(.01);
norberts 0:207850946233 19 l1=!l1;
norberts 0:207850946233 20 j=bus.read();
norberts 0:207850946233 21 if(j){
norberts 0:207850946233 22 //pc.printf("bus: %x i: %d\r",j,i++);
norberts 0:207850946233 23 if(j==1)
norberts 0:207850946233 24 usb.keyboard(' ');
norberts 0:207850946233 25 else if(j==2)
norberts 0:207850946233 26 usb.keyboard('i');
norberts 0:207850946233 27 else if(j==4)
norberts 0:207850946233 28 usb.keyboard('m');
norberts 0:207850946233 29 else if(j==8)
norberts 0:207850946233 30 usb.keyboard('j');
norberts 0:207850946233 31 else if(j==16)
norberts 0:207850946233 32 usb.keyboard('l');
norberts 0:207850946233 33 }
norberts 0:207850946233 34 }
norberts 0:207850946233 35 }