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.
Dependencies: 4DGL-uLCD-SE MMA8452Q SDFileSystem bouncing_ball mbed
Fork of OCE360_4 by
Revision 5:93f88deda5ba, committed 2017-11-07
- Comitter:
- rsean10
- Date:
- Tue Nov 07 15:24:31 2017 +0000
- Parent:
- 4:8118b752dea6
- Child:
- 6:050104c0dc75
- Commit message:
Changed in this revision
| bouncing_ball.lib | Show annotated file Show diff for this revision Revisions of this file |
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/bouncing_ball.lib Tue Nov 07 13:24:50 2017 +0000 +++ b/bouncing_ball.lib Tue Nov 07 15:24:31 2017 +0000 @@ -1,1 +1,1 @@ -https://os.mbed.com/users/slicht/code/bouncing_ball/#ba1844b0eb9f +https://os.mbed.com/users/slicht/code/bouncing_ball/#b3d6cd568c6c
--- a/main.cpp Tue Nov 07 13:24:50 2017 +0000
+++ b/main.cpp Tue Nov 07 15:24:31 2017 +0000
@@ -18,6 +18,11 @@
#define DEBUG_MODE 0
+#define LOG_UPDATE .091 //11 Hz
+
+//Initialize Serial communication
+Serial pc(USBTX, USBRX);
+
//Function prototype for color selection function:
int get_LCD_color(int color_integer);
@@ -30,8 +35,23 @@
physics_ball ball1; //initialize two balls for bouncing
physics_ball ball2; //the default states from the library will be used initially
-int main()
-{
+//Ticker for logging
+Ticker logger1;
+Ticker logger2;
+
+void pos_log1(){
+ pc.printf("Ball 1 (x): %i Ball 1 (y): %i \n\r",ball1.posx,ball1.posy);
+ }
+
+void pos_log2(){
+ pc.printf("Ball 2 (x): %i Ball 2 (y): %i \n\r",ball2.posx,ball2.posy);
+ }
+
+int main(){
+ /*
+ logger1.attach(&pos_log1, LOG_UPDATE);
+ logger2.attach(&pos_log2, LOG_UPDATE);
+ */
// Initialize uLCD
uLCD.baudrate(115200);
uLCD.background_color(BLACK);

