謙一 永井 / Mbed 2 deprecated SRC2018Auto

Dependencies:   mbed QEI2

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.h Source File

main.h

00001 #include "mbed.h"
00002 #include "DualShockMod.h"
00003 
00004 Serial pc(SERIAL_TX, SERIAL_RX);
00005 Serial tsuushin(PC_12,PD_2);    
00006 
00007 
00008 int main() {
00009 
00010 
00011 #if 1 //新しい割り込みの試み
00012     uint8_t InitDS(Serial* f_serial);
00013     void getPOSdata(void);
00014     tsuushin.baud(115200);    
00015     InitDS(&tsuushin);
00016     tsuushin.attach(&getPOSdata, Serial::RxIrq); //受信したら割り込み開始
00017 #endif
00018 
00019     //posX posYはint型で出力される、プラスマイナス付きの座標[mm]
00020     //宣言、定義などはDualShockMod.hで行われるため不要
00021 
00022     
00023 #if 1   //TEST MODE
00024     pc.printf("***IO TEST MODE***\n\r");
00025     pc.printf("3...");wait(1);
00026     pc.printf("2...");wait(1);
00027     pc.printf("1...\n\r");wait(1);
00028     while(1){
00029         #if 1
00030         pc.printf("posX=%d,posY=%d\n\r",posX,posY);
00031         #endif        
00032         wait(0.1);  //更新間隔
00033     }
00034 #endif
00035 
00036 
00037 }