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 3:a7f02754bc99, committed 2017-11-07
- Comitter:
- slicht
- Date:
- Tue Nov 07 12:09:39 2017 +0000
- Parent:
- 2:552e6feb8709
- Child:
- 4:8118b752dea6
- Commit message:
- Comments added.
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Tue Nov 07 12:07:36 2017 +0000
+++ b/main.cpp Tue Nov 07 12:09:39 2017 +0000
@@ -1,6 +1,7 @@
// A solution to OCE360 Homework #4.
// Objective: Use object oriented programming to create a system that displays
// multiple balls bouncing around the LCD screen.
+// Stephen Licht, 11/7/2017
#include "mbed.h"
#include "MMA8452Q.h" //acceleromater library
@@ -51,9 +52,8 @@
to update themselves at regular intervals, and te drawing the locations reported
by the ball objects on the LCD screen: */
while (1) { //execute 'forever'
- // Draw a red circle using the x and y positions stored by the object 'ball1':
+ // Draw circles in the x and y positions stored by the ball objects:
uLCD.filled_circle(ball1.posx, ball1.posy, ball1.radius, get_LCD_color(ball1.color));
- // Draw a blue circle using the x and y positions stored by the object 'ball2':
uLCD.filled_circle(ball2.posx, ball2.posy, ball2.radius, get_LCD_color(ball2.color));
// Wait before erasing old circles:
@@ -69,6 +69,7 @@
ball2.update(UPDATE_TIME_S,accel);
if (DEBUG_MODE) {
+ //If compiled with DEBUG_MODE flag raised, print values to screen.
uLCD.locate(0,4);
uLCD.printf("X: %d.1\nY: %.1d",ball1.posx,ball1.posy);
@@ -81,6 +82,7 @@
}
}
+//Interpret LCD colors.
int get_LCD_color(int color_integer)
{
switch (color_integer) {

