Refactor MAX7219 initialization and update MQ7 reading delay
This commit is contained in:
@@ -8,6 +8,7 @@ void MQ7_Init()
|
||||
|
||||
void MQ7_Read(float &sensorVolt, float &RSAir, float &R0, float &sensorValue)
|
||||
{
|
||||
// preheat
|
||||
analogWrite(ANALOG_MQ7, 1023);
|
||||
delay(60000);
|
||||
analogWrite(ANALOG_MQ7, (1023/5)*1.4 );
|
||||
@@ -15,16 +16,11 @@ void MQ7_Read(float &sensorVolt, float &RSAir, float &R0, float &sensorValue)
|
||||
for(int i = 0; i<100; i++)
|
||||
{
|
||||
sensorValue = sensorValue + analogRead(ANALOG_MQ7);
|
||||
delay(90000);
|
||||
delay(1200);
|
||||
}
|
||||
|
||||
sensorValue = sensorValue/100.0;
|
||||
sensorVolt = sensorValue/1024*5.0;
|
||||
RSAir = (5.0-sensorVolt)/sensorVolt;
|
||||
R0 = RSAir/(26+(1/3));
|
||||
|
||||
Serial.print("R0 = ");
|
||||
Serial.println(R0);
|
||||
|
||||
delay(1000);
|
||||
}
|
||||
Reference in New Issue
Block a user