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: 4DGL-uLCD-SE mbed
Fork of Gas_Sensor_best_copy by
Diff: main.cpp
- Revision:
- 0:bd3708b85a8b
- Child:
- 1:fec4764e82cb
diff -r 000000000000 -r bd3708b85a8b main.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Thu Jun 16 21:59:31 2016 +0000
@@ -0,0 +1,66 @@
+#include "mbed.h"
+#include "GasArray.h"
+#include "string.h"
+
+//base sensors' resistances
+float baseR[] = {9000, 650000};
+
+//number of sensors
+int number = 2;
+
+//input total voltage across divider
+float pwrV = 3;
+
+//corresponding divider resistances
+float dividerR[] = {1000, 201000};
+
+//corresponding sensor pins (analog in)
+AnalogIn places[] = {A0, A1};
+
+//sensitivity matrix (ONLY TAKES SQUARE MATRICES)
+float ISensitivityM[] = {-0.5,-0.001,-1,-0.0024};
+
+//sensor types
+string type[] = {"p-type", "n-type"};
+
+//gases
+string gas[] = {"NO", "NO2"};
+
+//tare button
+DigitalIn tareButton(p5);
+
+//initialize screen
+uLCD_4DGL uLCD(p28, p27, p29);
+
+//establish sensor array
+GasArray Device(number, baseR, pwrV, dividerR, places, ISensitivityM, type, gas);
+
+int main()
+{
+ //setup button
+ tareButton.rise(&zero);
+ //setup screen
+ uLCD.display_control(PORTRAIT);
+ uLCD.cls();
+ uLCD.baudrate(BAUD_3000000);
+ uLCD.background_color(BLACK);
+ //include cool credit
+ uLCD.printf("Georgia Tech \n\n Sensors and\n Catalysis Lab \n\n in collaboration with \n\n Hardy\n Technologies");
+ wait(.5);
+
+ //display percentages
+ Device.display_init(&uLCD);
+ //continuously update
+ while(1)
+ {
+ //read voltages
+ Device.read();
+ //display percentages
+ Device.display_cont(&uLCD);
+ }
+}
+
+void zero()
+{
+ //take voltage, use it to reform base resistances
+}
\ No newline at end of file
