Mamecontroller/joystick device wrapper library

Dependencies:   USBDevice mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 #include "USBKeyboard.h"
00003 #include "joystick.h"
00004  
00005 DebounceIn Up(p19);
00006 DebounceIn Down(D2);
00007 DebounceIn Left(D3);
00008 DebounceIn Right(D4);
00009 DebounceIn Jump(p16);
00010 DebounceIn Fire1(p17);
00011 DebounceIn Fire2(D7);
00012 
00013 BusOut leds(LED1, LED2, LED3);
00014  
00015 //USBKeyboard
00016 USBKeyboard keyboard;
00017 
00018 //Serial uart(USBTX, USBRX);
00019 Serial uart(p28, p27); 
00020 GPIOJoystick joy; 
00021  
00022 int main(void) {
00023     uart.baud(57600);
00024     uart.putc('A');
00025     int k = 0 ;
00026     while(k<3) {
00027 
00028         //Printf is also completely supported
00029         int i = 100;
00030         float f = 0.5;
00031         char h = 0x05;
00032         uart.printf("i = %d, f = %f, h = %02X \r\n", i, f, h);
00033         wait(3);
00034         k++;
00035     }
00036     wait(2);
00037     joy.init();
00038 }