![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
darkness activated switch
main.cpp@1:8cf180275a19, 2015-03-15 (annotated)
- Committer:
- faif
- Date:
- Sun Mar 15 17:16:15 2015 +0000
- Revision:
- 1:8cf180275a19
- Parent:
- 0:aa10f42a839d
revised
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
faif | 0:aa10f42a839d | 1 | #include "mbed.h" |
faif | 0:aa10f42a839d | 2 | #include "main.h" |
faif | 0:aa10f42a839d | 3 | |
faif | 0:aa10f42a839d | 4 | int main () |
faif | 0:aa10f42a839d | 5 | { |
faif | 1:8cf180275a19 | 6 | float ldr_value = 0; |
faif | 0:aa10f42a839d | 7 | while (true) |
faif | 0:aa10f42a839d | 8 | { |
faif | 0:aa10f42a839d | 9 | ldr_value = myldr; |
faif | 1:8cf180275a19 | 10 | if (ldr_value > THRES_OFF) |
faif | 1:8cf180275a19 | 11 | { |
faif | 1:8cf180275a19 | 12 | myled = LedOn; |
faif | 1:8cf180275a19 | 13 | } |
faif | 1:8cf180275a19 | 14 | if (ldr_value < THRES_ON) |
faif | 0:aa10f42a839d | 15 | { |
faif | 0:aa10f42a839d | 16 | myled = LedOff; |
faif | 0:aa10f42a839d | 17 | } |
faif | 0:aa10f42a839d | 18 | } |
faif | 0:aa10f42a839d | 19 | } |