Street light control system banate h, onboard LED ko light jaise use karke. Isme sabse important part h ldr ka min, max, ambient rakhke thresholds nikalna.
Dependencies: HysteresisIn mbed
main.cpp@0:2821276434a8, 2016-07-01 (annotated)
- Committer:
- akashlal
- Date:
- Fri Jul 01 09:25:42 2016 +0000
- Revision:
- 0:2821276434a8
na
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
akashlal | 0:2821276434a8 | 1 | #include "mbed.h" |
akashlal | 0:2821276434a8 | 2 | #include "HysteresisIn.h" |
akashlal | 0:2821276434a8 | 3 | |
akashlal | 0:2821276434a8 | 4 | //analog pin, two thresholds and initial state |
akashlal | 0:2821276434a8 | 5 | HysteresisIn ldr(PTB1, 0.2, 0.4, 0); |
akashlal | 0:2821276434a8 | 6 | DigitalOut led(PTD1); |
akashlal | 0:2821276434a8 | 7 | |
akashlal | 0:2821276434a8 | 8 | int main() { |
akashlal | 0:2821276434a8 | 9 | while(1) { |
akashlal | 0:2821276434a8 | 10 | led = 1-ldr.read();//led.write(ldr.read()); //boolean value |
akashlal | 0:2821276434a8 | 11 | } |
akashlal | 0:2821276434a8 | 12 | } |
akashlal | 0:2821276434a8 | 13 |