Isme bina HysterisisIn use kiye lab 18 ka output nikalte h. Program Ft. Chirayu Mahadeshwar
Dependencies: mbed
main.cpp@0:060c8e380e75, 2016-07-01 (annotated)
- Committer:
- akashlal
- Date:
- Fri Jul 01 09:29:45 2016 +0000
- Revision:
- 0:060c8e380e75
- Child:
- 1:c2e1412f8efe
na
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
akashlal | 0:060c8e380e75 | 1 | #include "mbed.h" |
akashlal | 0:060c8e380e75 | 2 | |
akashlal | 0:060c8e380e75 | 3 | //Hysterisis thresholds are 0.2 and 0.4 |
akashlal | 0:060c8e380e75 | 4 | AnalogIn ldr(PTB1); |
akashlal | 0:060c8e380e75 | 5 | DigitalOut led(PTD1); |
akashlal | 0:060c8e380e75 | 6 | |
akashlal | 0:060c8e380e75 | 7 | int main() { |
akashlal | 0:060c8e380e75 | 8 | float i; |
akashlal | 0:060c8e380e75 | 9 | while(1) { |
akashlal | 0:060c8e380e75 | 10 | i=ldr.read(); |
akashlal | 0:060c8e380e75 | 11 | if(i>=0.4) |
akashlal | 0:060c8e380e75 | 12 | led=0; |
akashlal | 0:060c8e380e75 | 13 | if(i<=0.2) |
akashlal | 0:060c8e380e75 | 14 | led=1; |
akashlal | 0:060c8e380e75 | 15 | |
akashlal | 0:060c8e380e75 | 16 | } |
akashlal | 0:060c8e380e75 | 17 | } |
akashlal | 0:060c8e380e75 | 18 |