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.
Revision 4:ae70d2be14e0, committed 2018-04-30
- Comitter:
- ahmedhedait
- Date:
- Mon Apr 30 03:21:44 2018 +0000
- Parent:
- 3:8c1d53e31ed7
- Child:
- 5:713ff302791f
- Commit message:
- I finished with the coding of which the circle should not get outside the drawn borders of the maze.
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Mon Apr 30 02:10:21 2018 +0000
+++ b/main.cpp Mon Apr 30 03:21:44 2018 +0000
@@ -91,6 +91,8 @@
circx += speed;
}
+
+
lcd.printString(" scr",0,0);
lcd.drawRect(0,0,65,48,FILL_TRANSPARENT);
lcd.setPixel(64,39,false);
@@ -99,11 +101,30 @@
lcd.setPixel(64,42,false);
lcd.setPixel(64,43,false);
lcd.setPixel(64,44,false);
-
+
printf("X = %f Y = %f", circx, circy);
lcd.drawCircle(circx,circy,2,FILL_BLACK);
- wait(1/10);
- lcd.refresh();
- }
+ if (circy < 3) {
+ circy = 3;
+ }
+
+ if (circy > HEIGHT - 4) {
+ circy = HEIGHT - 4;
+ }
+
+ if (circx < 3) {
+ circx = 3;
+ }
+
+
+ if (circx > 61) {
+ circx = 61;
+ }
+
+
+
+ wait(1/10);
+ lcd.refresh();
+}
}
\ No newline at end of file