get distance from ultrasonic sensor and print it with circle_UI on Nokia LCD

Dependencies:   RangeFinder mbed

Files at this revision

API Documentation at this revision

Comitter:
ryought
Date:
Thu Oct 18 15:46:15 2012 +0000
Parent:
0:8dccbeedd000
Commit message:
Second

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Thu Oct 18 15:41:43 2012 +0000
+++ b/main.cpp	Thu Oct 18 15:46:15 2012 +0000
@@ -48,17 +48,13 @@
             lcd.printf("%f cm", d*100);
             wait(0.5);
             */
-            for(circle_deg=0; circle_deg <= d*720; circle_deg++) {
-                circle_rad = circle_deg * PI / 180;
-                x = 65 + cos(circle_rad)*60;
-                y = 65 - sin(circle_rad)*60;
-                lcd.pixel(x, y, 0x00FFFF);
-            }
-            for(circle_deg=0; circle_deg <= d*720; circle_deg++) {
-                circle_rad = circle_deg * PI / 180;
-                x = 65 + cos(circle_rad)*55;
-                y = 65 - sin(circle_rad)*55;
-                lcd.pixel(x, y, 0x00FFFF);
+            for(int width=55; width < 61; width = width + 2
+                for(circle_deg=0; circle_deg <= d*720; circle_deg++) {
+                    circle_rad = circle_deg * PI / 180;
+                    x = 65 + cos(circle_rad)*width;
+                    y = 65 - sin(circle_rad)*width;
+                    lcd.pixel(x, y, 0x00FFFF);
+                }
             }
             lcd.locate(2, 7);
             lcd.printf("%f m", d);