Salinity and temperature sensors are implemented in classes.

Dependencies:   mbed

main.cpp

Committer:
mariosimaremare
Date:
2016-06-24
Revision:
14:6c24cab82ff0
Parent:
13:142a142a7ac5
Child:
15:e112bab9aa2f

File content as of revision 14:6c24cab82ff0:

/*
* G3: WATERPLAY
*/

#include "mbed.h"
#include "Flasher.h"
#include "SalinitySensor.h"
#include "TemperatureSensor.h"
#include "Thermostat.h"
#include "Procedure.h"
#include "Waterplay.h"
#include "TextLCD.h"
#include "Printer.h"
#include "Tank.h"

DRV8825 salinitySyringe(
    p21, p27, p28, p29, p22, p23
);
DRV8825 waterSyringe(
    p24, p27, p28, p29, p25, p26
);
TextLCD lcd(
    p19, p20, p11, p12, p13, p14
);
char buffer[128];
char program_name[128] = "G3: WATERPLAY";
int keep_running = 1;
Serial serial(USBTX, USBRX);
Flasher led1(LED1);
Flasher alarm(p17);
Printer printer(serial, lcd);

SalinitySensor salinitySensor(
    printer,
    p16
);
 
TemperatureSensor temperatureSensor(
    printer,
    p15
);
 
Thermostat thermostat(
    printer,
    p5,
    LED4
);
 
Ping pinger(p30);
 
Tank tank(
    printer,
    salinitySyringe,
    waterSyringe,
    pinger,
    alarm
);
 
Waterplay waterplay(
    printer,
    temperatureSensor,
    salinitySensor,
    thermostat,
    tank,
    led1,
    alarm
);

DigitalIn button(p7);

Procedure procedure(
    printer,
    button
);
 
int main()
{
    printer.display();
    led1.flash(1);
    procedure.proceed();
    tank.initialize();
 
    while(keep_running) {
        waterplay.control();
    }
}