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 1:8cf180275a19, committed 2015-03-15
- Comitter:
- faif
- Date:
- Sun Mar 15 17:16:15 2015 +0000
- Parent:
- 0:aa10f42a839d
- Commit message:
- revised
Changed in this revision
--- a/main.cpp Sat Feb 11 14:13:27 2012 +0000
+++ b/main.cpp Sun Mar 15 17:16:15 2015 +0000
@@ -1,22 +1,19 @@
#include "mbed.h"
#include "main.h"
-static const float threshOff = 0.5; // when to turn the led on
-static const float threshOn = 0.4; // when to turn the led off
-
int main ()
{
- float ldr_value;
+ float ldr_value = 0;
while (true)
{
ldr_value = myldr;
- if (ldr_value > threshOff)
+ if (ldr_value > THRES_OFF)
+ {
+ myled = LedOn;
+ }
+ if (ldr_value < THRES_ON)
{
myled = LedOff;
}
- if (ldr_value < threshOn)
- {
- myled = LedOn;
- }
}
}
--- a/main.h Sat Feb 11 14:13:27 2012 +0000
+++ b/main.h Sun Mar 15 17:16:15 2015 +0000
@@ -2,8 +2,10 @@
#define MAIN_H
enum {LedOff = 0, LedOn = 1};
+const float THRES_ON = 0.5; // when to turn the led on
+const float THRES_OFF = 0.4; // when to turn the led off
-AnalogIn myldr (p20);
-DigitalOut myled (LED1);
+AnalogIn myldr(p20);
+DigitalOut myled(LED2);
#endif
--- a/mbed.bld Sat Feb 11 14:13:27 2012 +0000 +++ b/mbed.bld Sun Mar 15 17:16:15 2015 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/mbed_official/code/mbed/builds/63bcd7ba4912 +http://mbed.org/users/mbed_official/code/mbed/builds/63bcd7ba4912 \ No newline at end of file