Skip to content

Commit 690185f

Browse files
author
BasicAirData
committed
OutputSerial
OutputSerial
1 parent aa5ce9f commit 690185f

4 files changed

Lines changed: 35 additions & 4 deletions

File tree

Software/Arduino/Libraries/AirDC/AirDC.cpp

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,5 +228,28 @@ void AirDC::ISAAltitude(int mode)
228228
}
229229

230230
}
231+
void AirDC::OutputSerial(int mode){
232+
switch(mode){
233+
case 1: //Measurements only output
234+
{
235+
//http://www.tigoe.com/pcomp/code/arduinowiring/1161/
236+
//Measurements
237+
//sprintf(_StreamOut,"$%f,%f,%f,%f\0",_p,_T,_RH,_qc);
238+
String s1(_p, 6);
239+
String s2(_T, 6);
240+
String s3(_RH, 6);
241+
String s4(_qc, 6);
242+
_StreamOut='$'+s1+','+s2+','+s3+','+s4;
243+
//To read string on the other side
244+
/*
245+
if (Serial.find("$")) {
246+
_p = Serial.parseFloat(); //
247+
_T = Serial.parseFloat();//
248+
_RH = Serial.parseFloat();//
249+
_qc = Serial.parseFloat();//
250+
*/
251+
}
252+
}
253+
}
231254

232255

Software/Arduino/Libraries/AirDC/AirDC.h

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,25 +18,30 @@ class AirDC
1818
void Mach(int mode);
1919
void OAT(int mode);
2020
void ISAAltitude(int mode);
21-
//private:
21+
void OutputSerial(int mode);
22+
//General use
2223
int _pid;
24+
String _StreamOut;
25+
//Measurements
2326
double _p;
2427
double _T;
2528
double _RH;
2629
double _qc;
30+
//AirData
2731
double _Rho;
2832
double _IAS;
2933
double _CAS;
3034
double _TAS;
3135
double _M;
3236
double _TAT;
3337
double _h;
34-
//uncertainty terms
38+
//Measurements Uncertainty
3539
double _up;
3640
double _uT;
3741
double _uRH;
38-
double _uRho;
3942
double _uqc;
43+
//AirData Uncertainty
44+
double _uRho;
4045
double _uIAS;
4146
double _uCAS;
4247
double _uTAS;

Software/Arduino/Libraries/AirDC/Examples/DifferentialPressureSensor/DifferentialPressureSensor.ino

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ void loop() {
6363
AirDataComputer.ISAAltitude(1);// Calculates the ISA altitude from static pressure, Algorithm 1
6464
delay(1000); //loop delay
6565
//Visualitation
66+
AirDataComputer.OutputSerial(1);
67+
Serial.println(AirDataComputer._StreamOut); // Prints measurements
6668
Serial.println(dpsensor); //Prints the Selected sensor
6769
Serial.println(psensor); //Prints the Selected sensor
6870
Serial.println(AirDataComputer._qc); //Differential pressure reading

Software/Arduino/Libraries/AirDC/keywords.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@ CAS KEYWORD2
55
TAS KEYWORD2
66
Mach KEYWORD2
77
OAT KEYWORD2
8-
ISAAltitude KEYWORD2
8+
ISAAltitude KEYWORD2
9+
OutputSerial KeYWORD2

0 commit comments

Comments
 (0)