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.
main.cpp
00001 #include "mbed.h" 00002 #include "SpaceBall.h" 00003 00004 PwmOut led[] = {(LED1), (LED2), (LED3), (LED4) }; 00005 SpaceBall SBall(p9, p10, true); // tx, rx, bSOrb 00006 Serial pc(USBTX, USBRX); // tx, rx 00007 Timer t; 00008 00009 int main() { 00010 t.start(); 00011 pc.baud(460800); 00012 pc.printf ( "SpaceBall Test\r\n\r\n" ); 00013 00014 SBall.Init(); 00015 00016 while(1) { 00017 00018 led[0] = abs( SBall[TX] ) + abs( SBall[TY] ) + abs( SBall[TZ] ); 00019 led[1] = abs( SBall[RX] ); 00020 led[2] = abs( SBall[RY] ); 00021 led[3] = abs( SBall[RZ] ); 00022 00023 if ( t.read_ms() > 1000 ) 00024 { 00025 t.reset(); 00026 t.start(); 00027 //myled = !myled; 00028 00029 pc.printf ( "SBall: %5d %5d %5d %5d %5d %5d %04X\r\n", 00030 SBall.GetAxisRaw(0), 00031 SBall.GetAxisRaw(1), 00032 SBall.GetAxisRaw(2), 00033 SBall.GetAxisRaw(3), 00034 SBall.GetAxisRaw(4), 00035 SBall.GetAxisRaw(5), 00036 SBall.GetButtons() ); 00037 } 00038 00039 wait_us(500); 00040 } 00041 }
Generated on Tue Jul 19 2022 04:52:19 by
1.7.2