Mario Simaremare
/
g3_waterplay
Salinity and temperature sensors are implemented in classes.
main.cpp
- Committer:
- mariosimaremare
- Date:
- 2016-06-16
- Revision:
- 3:7c648d1d8802
- Parent:
- 2:ed17e258da0d
- Child:
- 5:4cbe44452889
File content as of revision 3:7c648d1d8802:
/* * G3: WATERPLAY */ #include "mbed.h" #include "Flasher.h" #include "SalinitySensor.h" #include "TemperatureSensor.h" #include "Thermostat.h" #include "Waterplay.h" #include "DRV8825.h" #include "TextLCD.h" #include "Printer.h" #define MAX_SPEED 8000 #define MICROSTEPS_PER_STEP 16 DRV8825 stpr_mtr( p21, p22, p23, p24, p25, p26 ); TextLCD lcd( p19, p20, p21, p22, p23, p24 ); char buffer[128]; char program_name[128] = "G3: WATERPLAY"; int keep_running = 1; Serial serial(USBTX, USBRX); Flasher led1(LED1); Printer printer(serial, lcd); double salinity_voltage = 3.3; double salinity_converter = 1.6667; // 5.0/3.0 double salinity_multiplier = 16.3; double salinity_lower_boundary = 3.0; double salinity_upper_boundary = 7.0; double temperature_voltage = 4.85; double temperature_converter = 1.6667; // 5.0/3.0 double temperature_variance = 5.0; double temperature_vin = 4.85; double temperature_resistance = 15000.0; double temperature_lower_boundary = 27.0; double temperature_upper_boundary = 32.0; SalinitySensor salinitySensor( printer, p16, salinity_voltage, salinity_converter, salinity_multiplier, salinity_lower_boundary, salinity_upper_boundary ); TemperatureSensor temperatureSensor( printer, p15, temperature_voltage, temperature_converter, temperature_lower_boundary, temperature_upper_boundary, temperature_variance, temperature_vin, temperature_resistance ); Thermostat thermostat( serial, p18, LED4 ); Waterplay tempController( printer, temperatureSensor, salinitySensor, thermostat, led1 ); double salinity_value = 0.0; double temperature_value = 0.0; int main() { printer.display(); led1.flash(1); while(keep_running) { tempController.control(); } }