Water control
/
Water_pump
start
main.cpp@0:aa60e0772af6, 2017-06-07 (annotated)
- Committer:
- BillyGrande
- Date:
- Wed Jun 07 14:55:01 2017 +0000
- Revision:
- 0:aa60e0772af6
- Child:
- 1:924bead61d21
Read volt
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
BillyGrande | 0:aa60e0772af6 | 1 | #include "mbed.h" |
BillyGrande | 0:aa60e0772af6 | 2 | #include "TextLCD.h" |
BillyGrande | 0:aa60e0772af6 | 3 | |
BillyGrande | 0:aa60e0772af6 | 4 | TextLCD lcd(p25, p26, p24, p23, p22, p21); // rs, e, A4-A7 |
BillyGrande | 0:aa60e0772af6 | 5 | DigitalIn sw1(p5); |
BillyGrande | 0:aa60e0772af6 | 6 | AnalogIn sal(p15); |
BillyGrande | 0:aa60e0772af6 | 7 | |
BillyGrande | 0:aa60e0772af6 | 8 | int main() { |
BillyGrande | 0:aa60e0772af6 | 9 | while(1){ |
BillyGrande | 0:aa60e0772af6 | 10 | lcd.cls(); |
BillyGrande | 0:aa60e0772af6 | 11 | /* lcd.printf("Switch One is \n"); |
BillyGrande | 0:aa60e0772af6 | 12 | if(sw1==true){ |
BillyGrande | 0:aa60e0772af6 | 13 | lcd.printf("On"); |
BillyGrande | 0:aa60e0772af6 | 14 | } |
BillyGrande | 0:aa60e0772af6 | 15 | else{ |
BillyGrande | 0:aa60e0772af6 | 16 | lcd.printf("Off"); |
BillyGrande | 0:aa60e0772af6 | 17 | }*/ |
BillyGrande | 0:aa60e0772af6 | 18 | lcd.printf("Vout = %f", 3.3*sal.read()); |
BillyGrande | 0:aa60e0772af6 | 19 | wait(0.2); |
BillyGrande | 0:aa60e0772af6 | 20 | } |
BillyGrande | 0:aa60e0772af6 | 21 | } |