Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: KellerDruck_pressure PID PWM-Coil-driver Sensirion_SF04
Diff: main.h
- Revision:
- 4:49852dc27066
- Parent:
- 3:9ff79ea3a294
--- a/main.h Mon Jul 24 15:38:39 2017 +0000 +++ b/main.h Fri Sep 08 21:27:10 2017 +0000 @@ -1,29 +1,31 @@ #ifndef MAIN_H #define MAIN_H +#define pressureWait 100 +#define airflowWait 100 + #include "mbed.h" #include "keller_pressure.h" #include "sensirion_sf04.h" #include "PID.h" #include "coil-driver.h" -#include "VL6180.h" - -Coil shutoff(PE_5, 5000, 40, 6); // Shutoff valve, 5ms spike time, 25kHz PWM at 15% duty cycle -Coil injector(PF_8, 200, 40, 3); // Injector valve, 200us spike time, 25kHz PWM at 7.5% duty cycle - +//#include "VL6180.h" // Mbed application shield display #include "C12832A1Z.h" #include "Small_7.h" #include "Fonts/ArialR12x14.h" +Coil shutoff(PE_5, 5000, 40, 6); // Shutoff valve, 5ms spike time, 25kHz PWM at 15% duty cycle +Coil injector(PF_8, 200, 40, 3); // Injector valve, 200us spike time, 25kHz PWM at 7.5% duty cycle + C12832A1Z lcd(D11, D13, D12, D7, D10); // MOSI, SCK, Reset, A0, CS // LCD width and height (minus 1) #define lcdWidth 127 #define lcdHeight 31 // ISO/SEV pressure: 10psi, DES: 25-30psi -#define pumpSetPointPSI 45 +float pumpSetPointPSI=0; #define pumpMinPSI 0 #define pumpMaxPSI 85 //#define pumpHystPSI 2 @@ -34,8 +36,8 @@ // Liquid pump defines // PID settings -#define pumpPIDRate .2 // Pump PID computation interval (seconds) -float pumpKp = 4.0; +#define pumpPIDRate pressureWait/1000.0 // Pump PID computation interval (seconds) +float pumpKp = 2.0; float pumpKi = 1.0; #define pumpKd 0 @@ -49,7 +51,7 @@ Mutex i2c1_m, i2c2_m, stdio_m; //DigitalOut myled(LED2); -Serial pc(USBTX, USBRX, 250000); // tx, rx, baud +Serial pc(USBTX, USBRX, 115200); // tx, rx, baud // an I2C sub-class that provides a constructed default class I2CPreInit : public I2C @@ -82,15 +84,20 @@ PID pump_control_PID(pumpKp, pumpKi, pumpKd, pumpPIDRate); -//InterruptIn pumpTach(pumpTachPin); -volatile int pumpTachCounts = 0; -volatile float pumpRpm = 0; +int pumpTachCounts = 0; +float pumpRpm = 0; +InterruptIn pumpTach(pumpTachPin); PwmOut ledRed(PE_11); PwmOut ledGrn(PD_15); DigitalOut ledBlu(PF_12); // Level sensor -VL6180 level(i2c1); //I2C object -float agentlevel = 0; +//VL6180 level(i2c1); //I2C object +//float agentlevel = 0; + +//Timer t; // Runtime timer +//float runtime; + +bool completed = false; #endif \ No newline at end of file