Auto Shut-off safety system for stove
Dependencies: mbed Motordriver DHT
main.cpp@0:c8b31227d874, 2019-02-26 (annotated)
- Committer:
- Niranjan_ravi
- Date:
- Tue Feb 26 18:40:51 2019 +0000
- Revision:
- 0:c8b31227d874
- Child:
- 1:b63b3fcf72d1
proximity sensor
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Niranjan_ravi | 0:c8b31227d874 | 1 | #include "mbed.h" |
Niranjan_ravi | 0:c8b31227d874 | 2 | Serial pc(USBTX, USBRX); // tx, rx |
Niranjan_ravi | 0:c8b31227d874 | 3 | DigitalOut led(LED1); |
Niranjan_ravi | 0:c8b31227d874 | 4 | DigitalIn pir(D2); //Connect it to |
Niranjan_ravi | 0:c8b31227d874 | 5 | Timer timer; |
Niranjan_ravi | 0:c8b31227d874 | 6 | |
Niranjan_ravi | 0:c8b31227d874 | 7 | int main() |
Niranjan_ravi | 0:c8b31227d874 | 8 | { |
Niranjan_ravi | 0:c8b31227d874 | 9 | while(1) { |
Niranjan_ravi | 0:c8b31227d874 | 10 | if(!pir){ |
Niranjan_ravi | 0:c8b31227d874 | 11 | led = 0; |
Niranjan_ravi | 0:c8b31227d874 | 12 | pc.printf("Nothing Detected\r\n"); |
Niranjan_ravi | 0:c8b31227d874 | 13 | wait(1); |
Niranjan_ravi | 0:c8b31227d874 | 14 | } |
Niranjan_ravi | 0:c8b31227d874 | 15 | else { |
Niranjan_ravi | 0:c8b31227d874 | 16 | led=1; |
Niranjan_ravi | 0:c8b31227d874 | 17 | pc.printf("Motion Detected\r\n"); |
Niranjan_ravi | 0:c8b31227d874 | 18 | wait(1); |
Niranjan_ravi | 0:c8b31227d874 | 19 | } |
Niranjan_ravi | 0:c8b31227d874 | 20 | } |
Niranjan_ravi | 0:c8b31227d874 | 21 | } |