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.
Diff: main.cpp
- Revision:
- 0:a3ea8c7fa1ac
- Child:
- 1:11adb289a51b
diff -r 000000000000 -r a3ea8c7fa1ac main.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Sat Dec 01 05:30:50 2012 +0000
@@ -0,0 +1,39 @@
+#include "mbed.h"
+#include "SpaceBall.h"
+
+PwmOut led[] = {(LED1), (LED2), (LED3), (LED4) };
+SpaceBall SBall(p9, p10); // tx, rx, bSOrb
+Serial pc(USBTX, USBRX); // tx, rx
+Timer t;
+
+int main() {
+ t.start();
+ pc.baud(460800);
+ pc.printf ( "SpaceBall Test\r\n\r\n" );
+
+ while(1) {
+
+ led[0] = abs( SBall[TX] ) + abs( SBall[TY] ) + abs( SBall[TZ] );
+ led[1] = abs( SBall[RX] );
+ led[2] = abs( SBall[RY] );
+ led[3] = abs( SBall[RZ] );
+
+ if ( t.read_ms() > 1000 )
+ {
+ t.reset();
+ t.start();
+ //myled = !myled;
+
+ pc.printf ( "SBall: %5d %5d %5d %5d %5d %5d %04X\r\n",
+ SBall.GetAxisRaw(0),
+ SBall.GetAxisRaw(1),
+ SBall.GetAxisRaw(2),
+ SBall.GetAxisRaw(3),
+ SBall.GetAxisRaw(4),
+ SBall.GetAxisRaw(5),
+ SBall.GetButtons() );
+ }
+
+ wait_us(500);
+ }
+}