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.
Diff: main.cpp
- Revision:
- 2:3cceb8854782
- Parent:
- 1:ecbb7b79f50a
- Child:
- 3:ce199b093e2f
diff -r ecbb7b79f50a -r 3cceb8854782 main.cpp
--- a/main.cpp Tue Oct 18 14:44:56 2011 +0000
+++ b/main.cpp Tue Oct 18 14:54:43 2011 +0000
@@ -1,17 +1,22 @@
-#include "mbed.h"
-
-AnalogIn sensor(p20);
-
-int main() {
-
- //while(1) {
- if(sensor > 1.5) {
- printf("Too near! (%f)", sensor.read());
- }
- else{
- printf("Error (%f)", sensor.read());
-
- }
- //}
-}
-
+#include "mbed.h"
+
+AnalogIn sensor(p20);
+DigitalOut led(LED1);
+
+int main() {
+
+ while(1) {
+ sensor.read();
+
+ if(sensor > 1.5) {
+ led = !led;
+ wait(1);
+ }
+ else{
+ led = !led;
+ wait(1);
+
+ }
+ }
+}
+