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: mbed
Fork of 3BHEL_LDR by
Diff: main.cpp
- Revision:
- 0:4a51d86e4cbd
- Child:
- 1:987bbbdbcedf
diff -r 000000000000 -r 4a51d86e4cbd main.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Thu Jan 21 15:01:53 2016 +0000
@@ -0,0 +1,23 @@
+#include "mbed.h"
+
+AnalogIn LDR(p16);
+
+BusOut myled(P1_13,P1_12,P1_7,P1_6,P1_4,P1_3,P1_1,P1_0,LED4,LED3,LED2,LED1);
+
+Serial pc(USBTX,USBRX);
+
+int main() {
+ while(1) {
+ // myled=LDR.read_u16()/64;
+ pc.printf("\r%u %f\n", (LDR.read_u16()/62), LDR.read());
+ wait(0.1);
+
+ int licht= LDR.read_u16()/64;
+
+ myled = 0;
+ for(int i = 0 ;i < licht / 75; i++ )
+ {
+ myled = 0b1<<i | myled ;
+ }
+ }
+}
\ No newline at end of file
