Mario Simaremare
/
g3_waterplay
Salinity and temperature sensors are implemented in classes.
main.cpp@6:931a7fe8fa52, 2016-06-17 (annotated)
- Committer:
- mariosimaremare
- Date:
- Fri Jun 17 12:19:16 2016 +0000
- Revision:
- 6:931a7fe8fa52
- Parent:
- 5:4cbe44452889
- Child:
- 7:46e65aeb4df2
Add Tank component.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mariosimaremare | 0:ad9362f18797 | 1 | /* |
mariosimaremare | 0:ad9362f18797 | 2 | * G3: WATERPLAY |
mariosimaremare | 0:ad9362f18797 | 3 | */ |
mariosimaremare | 0:ad9362f18797 | 4 | |
mariosimaremare | 0:ad9362f18797 | 5 | #include "mbed.h" |
mariosimaremare | 0:ad9362f18797 | 6 | #include "Flasher.h" |
mariosimaremare | 0:ad9362f18797 | 7 | #include "SalinitySensor.h" |
mariosimaremare | 0:ad9362f18797 | 8 | #include "TemperatureSensor.h" |
mariosimaremare | 2:ed17e258da0d | 9 | #include "Thermostat.h" |
mariosimaremare | 3:7c648d1d8802 | 10 | #include "Waterplay.h" |
mariosimaremare | 3:7c648d1d8802 | 11 | #include "TextLCD.h" |
mariosimaremare | 3:7c648d1d8802 | 12 | #include "Printer.h" |
mariosimaremare | 6:931a7fe8fa52 | 13 | #include "Tank.h" |
mariosimaremare | 6:931a7fe8fa52 | 14 | |
mariosimaremare | 6:931a7fe8fa52 | 15 | DRV8825 salinitySyringe( |
mariosimaremare | 6:931a7fe8fa52 | 16 | p21, p27, p28, p29, p22, p23 |
mariosimaremare | 6:931a7fe8fa52 | 17 | ); |
mariosimaremare | 6:931a7fe8fa52 | 18 | DRV8825 waterSyringe( |
mariosimaremare | 6:931a7fe8fa52 | 19 | p24, p27, p28, p29, p25, p26 |
mariosimaremare | 3:7c648d1d8802 | 20 | ); |
mariosimaremare | 3:7c648d1d8802 | 21 | TextLCD lcd( |
mariosimaremare | 3:7c648d1d8802 | 22 | p19, p20, p21, p22, p23, p24 |
mariosimaremare | 3:7c648d1d8802 | 23 | ); |
mariosimaremare | 3:7c648d1d8802 | 24 | char buffer[128]; |
mariosimaremare | 0:ad9362f18797 | 25 | char program_name[128] = "G3: WATERPLAY"; |
mariosimaremare | 0:ad9362f18797 | 26 | int keep_running = 1; |
mariosimaremare | 0:ad9362f18797 | 27 | Serial serial(USBTX, USBRX); |
mariosimaremare | 0:ad9362f18797 | 28 | Flasher led1(LED1); |
mariosimaremare | 3:7c648d1d8802 | 29 | Printer printer(serial, lcd); |
mariosimaremare | 0:ad9362f18797 | 30 | |
mariosimaremare | 0:ad9362f18797 | 31 | SalinitySensor salinitySensor( |
mariosimaremare | 3:7c648d1d8802 | 32 | printer, |
mariosimaremare | 5:4cbe44452889 | 33 | p16 |
mariosimaremare | 0:ad9362f18797 | 34 | ); |
mariosimaremare | 0:ad9362f18797 | 35 | |
mariosimaremare | 0:ad9362f18797 | 36 | TemperatureSensor temperatureSensor( |
mariosimaremare | 3:7c648d1d8802 | 37 | printer, |
mariosimaremare | 5:4cbe44452889 | 38 | p15 |
mariosimaremare | 0:ad9362f18797 | 39 | ); |
mariosimaremare | 0:ad9362f18797 | 40 | |
mariosimaremare | 2:ed17e258da0d | 41 | Thermostat thermostat( |
mariosimaremare | 5:4cbe44452889 | 42 | printer, |
mariosimaremare | 2:ed17e258da0d | 43 | p18, |
mariosimaremare | 2:ed17e258da0d | 44 | LED4 |
mariosimaremare | 2:ed17e258da0d | 45 | ); |
mariosimaremare | 2:ed17e258da0d | 46 | |
mariosimaremare | 6:931a7fe8fa52 | 47 | Tank tank( |
mariosimaremare | 6:931a7fe8fa52 | 48 | printer, |
mariosimaremare | 6:931a7fe8fa52 | 49 | salinitySyringe, |
mariosimaremare | 6:931a7fe8fa52 | 50 | waterSyringe |
mariosimaremare | 6:931a7fe8fa52 | 51 | ); |
mariosimaremare | 6:931a7fe8fa52 | 52 | |
mariosimaremare | 5:4cbe44452889 | 53 | Waterplay waterplay( |
mariosimaremare | 3:7c648d1d8802 | 54 | printer, |
mariosimaremare | 3:7c648d1d8802 | 55 | temperatureSensor, |
mariosimaremare | 3:7c648d1d8802 | 56 | salinitySensor, |
mariosimaremare | 3:7c648d1d8802 | 57 | thermostat, |
mariosimaremare | 6:931a7fe8fa52 | 58 | tank, |
mariosimaremare | 3:7c648d1d8802 | 59 | led1 |
mariosimaremare | 3:7c648d1d8802 | 60 | ); |
mariosimaremare | 3:7c648d1d8802 | 61 | |
mariosimaremare | 0:ad9362f18797 | 62 | int main() |
mariosimaremare | 0:ad9362f18797 | 63 | { |
mariosimaremare | 3:7c648d1d8802 | 64 | printer.display(); |
mariosimaremare | 3:7c648d1d8802 | 65 | led1.flash(1); |
mariosimaremare | 0:ad9362f18797 | 66 | |
mariosimaremare | 0:ad9362f18797 | 67 | while(keep_running) { |
mariosimaremare | 5:4cbe44452889 | 68 | waterplay.control(); |
mariosimaremare | 0:ad9362f18797 | 69 | } |
mariosimaremare | 0:ad9362f18797 | 70 | } |