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
Revision 1:fec4764e82cb, committed 2016-06-28
- Comitter:
- nhardy6
- Date:
- Tue Jun 28 18:58:40 2016 +0000
- Parent:
- 0:bd3708b85a8b
- Commit message:
- finished tare button
Changed in this revision
--- a/GasArray.cpp Thu Jun 16 21:59:31 2016 +0000
+++ b/GasArray.cpp Tue Jun 28 18:58:40 2016 +0000
@@ -73,4 +73,12 @@
uLCD -> locate(10,2*i+1+3*number);
uLCD -> printf("%2.03f", percentages[i]);
}
+}
+
+void GasArray::tare()
+{
+ for(int i=0; i<number; i++)
+ {
+ baseR[i]=(responseV[i]*dividerR[i])/(pwrV-responseV[i]);
+ }
}
\ No newline at end of file
--- a/GasArray.h Thu Jun 16 21:59:31 2016 +0000
+++ b/GasArray.h Tue Jun 28 18:58:40 2016 +0000
@@ -9,6 +9,7 @@
void read(); // Returns voltage values
void display_init(uLCD_4DGL *uLCD); // Prints sensor types and gases
void display_cont(uLCD_4DGL *uLCD); // Prints response and gas percentages
+ void tare(); // Adjusts base resistances for no gas
private:
int number; // Number of sensors
float * baseR; // Base resistance of sensors
--- a/main.cpp Thu Jun 16 21:59:31 2016 +0000
+++ b/main.cpp Tue Jun 28 18:58:40 2016 +0000
@@ -27,7 +27,7 @@
string gas[] = {"NO", "NO2"};
//tare button
-DigitalIn tareButton(p5);
+InterruptIn tareButton(p5);
//initialize screen
uLCD_4DGL uLCD(p28, p27, p29);
@@ -35,6 +35,11 @@
//establish sensor array
GasArray Device(number, baseR, pwrV, dividerR, places, ISensitivityM, type, gas);
+void zero()
+{
+ Device.tare();
+}
+
int main()
{
//setup button
@@ -58,9 +63,4 @@
//display percentages
Device.display_cont(&uLCD);
}
-}
-
-void zero()
-{
- //take voltage, use it to reform base resistances
}
\ No newline at end of file
