プレステ1アナログコントローラ用ライブラリのサンプル

Dependencies:   mbed-src

Files at this revision

API Documentation at this revision

Comitter:
kurt
Date:
Mon Sep 09 06:34:48 2013 +0000
Parent:
1:38674ebae5dc
Child:
3:3a33f8294a84
Commit message:
?????????

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Mon Sep 09 06:34:48 2013 +0000
@@ -0,0 +1,20 @@
+#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);
+    }
+}
\ No newline at end of file