プレステ1アナログコントローラ用ライブラリのサンプル
main.cpp
- Committer:
- kurt
- Date:
- 2013-09-09
- Revision:
- 0:ab4722670dd8
File content as of revision 0:ab4722670dd8:
#include "mbed.h" #include "pspad.h" Serial pc(USBTX, USBRX); Pspad PS(PTB11,PTB10,PTB9,PTB8); Timer LapTime; int main() { pc.baud(921600); while(1) { PS.PsRead(); pc.printf("time:%d",LapTime.read_us()); LapTime.start(); if(PS.BUTTON.BIT.MARU&&(0==PS.PREV.BUTTON.BIT.MARU)) PS.VIBRATE = 1-PS.VIBRATE; pc.printf("%5d %5d", PS.BUTTON.BIT.MARU, PS.PREV.BUTTON.BIT.MARU); pc.printf("%5d %5d %5d %5d %5d \r\n", PS.BUTTON.WORD, PS.right_x, PS.right_y, PS.left_x, PS.left_y); } }