![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Sample program for based on LM393 Raindrop sensor, just have one function, return TRUE or FALSE
main.cpp@1:bc4d3b9054d0, 2019-02-08 (annotated)
- Committer:
- Yifan_Du
- Date:
- Fri Feb 08 06:58:05 2019 +0000
- Revision:
- 1:bc4d3b9054d0
- Parent:
- 0:bbeffbedaccb
Corrector
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Yifan_Du | 0:bbeffbedaccb | 1 | /* |
Yifan_Du | 0:bbeffbedaccb | 2 | Copyright (c) 2019 Yifan DU |
Yifan_Du | 0:bbeffbedaccb | 3 | |
Yifan_Du | 0:bbeffbedaccb | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy |
Yifan_Du | 0:bbeffbedaccb | 5 | of this software and associated documentation files (the "Software"), to deal |
Yifan_Du | 0:bbeffbedaccb | 6 | in the Software without restriction, including without limitation the rights |
Yifan_Du | 0:bbeffbedaccb | 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
Yifan_Du | 0:bbeffbedaccb | 8 | copies of the Software, and to permit persons to whom the Software is |
Yifan_Du | 0:bbeffbedaccb | 9 | furnished to do so, subject to the following conditions: |
Yifan_Du | 0:bbeffbedaccb | 10 | |
Yifan_Du | 0:bbeffbedaccb | 11 | The above copyright notice and this permission notice shall be included in |
Yifan_Du | 0:bbeffbedaccb | 12 | all copies or substantial portions of the Software. |
Yifan_Du | 0:bbeffbedaccb | 13 | |
Yifan_Du | 0:bbeffbedaccb | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
Yifan_Du | 0:bbeffbedaccb | 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
Yifan_Du | 0:bbeffbedaccb | 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
Yifan_Du | 0:bbeffbedaccb | 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
Yifan_Du | 0:bbeffbedaccb | 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
Yifan_Du | 0:bbeffbedaccb | 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
Yifan_Du | 0:bbeffbedaccb | 20 | THE SOFTWARE. |
Yifan_Du | 0:bbeffbedaccb | 21 | |
Yifan_Du | 0:bbeffbedaccb | 22 | 1.0 8-Feb.-2019 Initial release. |
Yifan_Du | 0:bbeffbedaccb | 23 | |
Yifan_Du | 0:bbeffbedaccb | 24 | */ |
Yifan_Du | 0:bbeffbedaccb | 25 | |
Yifan_Du | 0:bbeffbedaccb | 26 | #include "mbed.h" |
Yifan_Du | 0:bbeffbedaccb | 27 | #include "Raindrop.h" |
Yifan_Du | 1:bc4d3b9054d0 | 28 | // A0 D0 |
Yifan_Du | 0:bbeffbedaccb | 29 | Raindrop Raindrop(PC_2, PC_3); |
Yifan_Du | 0:bbeffbedaccb | 30 | |
Yifan_Du | 0:bbeffbedaccb | 31 | int main(void) |
Yifan_Du | 0:bbeffbedaccb | 32 | { |
Yifan_Du | 0:bbeffbedaccb | 33 | while(1) |
Yifan_Du | 0:bbeffbedaccb | 34 | { |
Yifan_Du | 1:bc4d3b9054d0 | 35 | if(Raindrop.Check_Raindrop() == false) |
Yifan_Du | 0:bbeffbedaccb | 36 | printf("Not rain\r\n"); |
Yifan_Du | 0:bbeffbedaccb | 37 | else |
Yifan_Du | 1:bc4d3b9054d0 | 38 | printf("Rain now\r\n"); |
Yifan_Du | 1:bc4d3b9054d0 | 39 | |
Yifan_Du | 0:bbeffbedaccb | 40 | wait(1); |
Yifan_Du | 0:bbeffbedaccb | 41 | } |
Yifan_Du | 0:bbeffbedaccb | 42 | } |