Salinity and temperature sensors are implemented in classes.

Dependencies:   mbed

Committer:
mariosimaremare
Date:
Fri Jun 24 13:46:52 2016 +0000
Revision:
14:6c24cab82ff0
Parent:
13:142a142a7ac5
Child:
15:e112bab9aa2f
Finished, ready for presentation.

Who changed what in which revision?

UserRevisionLine numberNew 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 12:7a48b90b493e 10 #include "Procedure.h"
mariosimaremare 3:7c648d1d8802 11 #include "Waterplay.h"
mariosimaremare 3:7c648d1d8802 12 #include "TextLCD.h"
mariosimaremare 3:7c648d1d8802 13 #include "Printer.h"
mariosimaremare 6:931a7fe8fa52 14 #include "Tank.h"
mariosimaremare 6:931a7fe8fa52 15
mariosimaremare 6:931a7fe8fa52 16 DRV8825 salinitySyringe(
mariosimaremare 6:931a7fe8fa52 17 p21, p27, p28, p29, p22, p23
mariosimaremare 6:931a7fe8fa52 18 );
mariosimaremare 6:931a7fe8fa52 19 DRV8825 waterSyringe(
mariosimaremare 6:931a7fe8fa52 20 p24, p27, p28, p29, p25, p26
mariosimaremare 3:7c648d1d8802 21 );
mariosimaremare 3:7c648d1d8802 22 TextLCD lcd(
mariosimaremare 11:dcaaf1bb21ce 23 p19, p20, p11, p12, p13, p14
mariosimaremare 3:7c648d1d8802 24 );
mariosimaremare 3:7c648d1d8802 25 char buffer[128];
mariosimaremare 0:ad9362f18797 26 char program_name[128] = "G3: WATERPLAY";
mariosimaremare 0:ad9362f18797 27 int keep_running = 1;
mariosimaremare 0:ad9362f18797 28 Serial serial(USBTX, USBRX);
mariosimaremare 0:ad9362f18797 29 Flasher led1(LED1);
mariosimaremare 13:142a142a7ac5 30 Flasher alarm(p17);
mariosimaremare 3:7c648d1d8802 31 Printer printer(serial, lcd);
mariosimaremare 13:142a142a7ac5 32
mariosimaremare 0:ad9362f18797 33 SalinitySensor salinitySensor(
mariosimaremare 3:7c648d1d8802 34 printer,
mariosimaremare 5:4cbe44452889 35 p16
mariosimaremare 0:ad9362f18797 36 );
mariosimaremare 11:dcaaf1bb21ce 37
mariosimaremare 0:ad9362f18797 38 TemperatureSensor temperatureSensor(
mariosimaremare 3:7c648d1d8802 39 printer,
mariosimaremare 5:4cbe44452889 40 p15
mariosimaremare 0:ad9362f18797 41 );
mariosimaremare 11:dcaaf1bb21ce 42
mariosimaremare 2:ed17e258da0d 43 Thermostat thermostat(
mariosimaremare 5:4cbe44452889 44 printer,
mariosimaremare 13:142a142a7ac5 45 p5,
mariosimaremare 2:ed17e258da0d 46 LED4
mariosimaremare 2:ed17e258da0d 47 );
mariosimaremare 11:dcaaf1bb21ce 48
mariosimaremare 7:46e65aeb4df2 49 Ping pinger(p30);
mariosimaremare 11:dcaaf1bb21ce 50
mariosimaremare 6:931a7fe8fa52 51 Tank tank(
mariosimaremare 6:931a7fe8fa52 52 printer,
mariosimaremare 6:931a7fe8fa52 53 salinitySyringe,
mariosimaremare 7:46e65aeb4df2 54 waterSyringe,
mariosimaremare 11:dcaaf1bb21ce 55 pinger,
mariosimaremare 11:dcaaf1bb21ce 56 alarm
mariosimaremare 6:931a7fe8fa52 57 );
mariosimaremare 11:dcaaf1bb21ce 58
mariosimaremare 5:4cbe44452889 59 Waterplay waterplay(
mariosimaremare 3:7c648d1d8802 60 printer,
mariosimaremare 3:7c648d1d8802 61 temperatureSensor,
mariosimaremare 3:7c648d1d8802 62 salinitySensor,
mariosimaremare 3:7c648d1d8802 63 thermostat,
mariosimaremare 6:931a7fe8fa52 64 tank,
mariosimaremare 11:dcaaf1bb21ce 65 led1,
mariosimaremare 11:dcaaf1bb21ce 66 alarm
mariosimaremare 3:7c648d1d8802 67 );
mariosimaremare 12:7a48b90b493e 68
mariosimaremare 12:7a48b90b493e 69 DigitalIn button(p7);
mariosimaremare 12:7a48b90b493e 70
mariosimaremare 12:7a48b90b493e 71 Procedure procedure(
mariosimaremare 12:7a48b90b493e 72 printer,
mariosimaremare 12:7a48b90b493e 73 button
mariosimaremare 12:7a48b90b493e 74 );
mariosimaremare 11:dcaaf1bb21ce 75
mariosimaremare 0:ad9362f18797 76 int main()
mariosimaremare 0:ad9362f18797 77 {
mariosimaremare 3:7c648d1d8802 78 printer.display();
mariosimaremare 3:7c648d1d8802 79 led1.flash(1);
mariosimaremare 14:6c24cab82ff0 80 procedure.proceed();
mariosimaremare 14:6c24cab82ff0 81 tank.initialize();
mariosimaremare 11:dcaaf1bb21ce 82
mariosimaremare 0:ad9362f18797 83 while(keep_running) {
mariosimaremare 5:4cbe44452889 84 waterplay.control();
mariosimaremare 0:ad9362f18797 85 }
mariosimaremare 0:ad9362f18797 86 }