Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
main.cpp
- Committer:
- norberts
- Date:
- 2011-09-07
- Revision:
- 1:afc3bf972645
- Parent:
- 0:207850946233
- Child:
- 2:1a24252c8cb1
File content as of revision 1:afc3bf972645:
#include "mbed.h" #include "usbhid.h" DigitalOut l1(LED1),l2(LED2); Serial pc(USBTX, USBRX); // tx, rx BusIn bus(p21,p22,p23,p24,p25); usbhid usb; int main() { int i=0,j; pc.printf("I live! Again ...\r"); usb.keyboard("rem "); while(1){ wait(.01); l1=!l1; j=bus.read(); if(j){ l2=1; //pc.printf("bus: %x i: %d\r",j,i++); if(j==1) usb.keyboard(' '); else if(j==2) usb.keyboard('w'); // up else if(j==4) usb.keyboard('s'); // down else if(j==8) usb.keyboard('a'); // left else if(j==16) usb.keyboard('d'); // right } else l2=0; } }