Refactor MAX7219 initialization and update MQ7 reading delay
This commit is contained in:
@@ -4,7 +4,6 @@
|
||||
|
||||
#define HARDWARE_TYPE MD_MAX72XX::FC16_HW
|
||||
#define MAX_DEVICES 4 // 4 modulos 8x8
|
||||
|
||||
#define DATA_PIN 19
|
||||
#define CS_PIN 18
|
||||
#define CLK_PIN 17
|
||||
|
||||
@@ -5,7 +5,7 @@ MD_Parola display = MD_Parola(HARDWARE_TYPE, DATA_PIN, CLK_PIN, CS_PIN, MAX_DEVI
|
||||
void MAX7219_Init()
|
||||
{
|
||||
display.begin();
|
||||
display.setIntensity(1); // 0-15
|
||||
display.setIntensity(15); // 0-15
|
||||
display.displayClear();
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
@@ -13,19 +13,19 @@ void setup()
|
||||
{
|
||||
Serial.begin(9600);
|
||||
|
||||
Serial.println("Iniciando...");
|
||||
/*Serial.println("Iniciando...");
|
||||
MQ7_Init();
|
||||
Serial.println("Sensor MQ7 inicializado");
|
||||
BME280_Init();
|
||||
Serial.println("Sensor BME280 inicializado");
|
||||
GPS_Init();
|
||||
Serial.println("GPS inicializado");
|
||||
Serial.println("GPS inicializado"); */
|
||||
MAX7219_Init();
|
||||
Serial.println("Display inicializado");
|
||||
|
||||
prettyReadBME280();
|
||||
prettyReadMQ7();
|
||||
//prettyReadBME280();
|
||||
testMatrix();
|
||||
//prettyReadMQ7();
|
||||
}
|
||||
|
||||
void loop()
|
||||
@@ -65,6 +65,7 @@ void testMatrix()
|
||||
{
|
||||
Serial.println("Escribiendo en el display...");
|
||||
MAX7219_DisplayText("Prueba de texto", PA_LEFT, 100, 500);
|
||||
|
||||
}
|
||||
|
||||
uint32_t getChipID()
|
||||
|
||||
Reference in New Issue
Block a user