ISR(TIMER2_OVF_vect) compiling error for grove sensor

Hello I am using Grove - Air Quality Sensor v1.3 with Seedunio LoRaWAN. I have uploaded my grove sensor code in arduino but I got this error:


Arduino: 1.8.15 Hourly Build 2021/05/19 12:33 (Windows 10), Board: "Seeeduino LoRaWAN, Arduino, Off"

sketch_jun24b:25:5: error: expected constructor, destructor, or type conversion before '(' token

 ISR(TIMER2_OVF_vect)

     ^

sketch_jun24b:25:4: error: expected constructor, destructor, or type conversion before '(' token

 ISR(TIMER2_OVF_vect)

    ^

exit status 1

expected constructor, destructor, or type conversion before '(' token

My sensor code is here:

#include"AirQuality.h"
#include"Arduino.h"
AirQuality airqualitysensor;
int current_quality =-1;
void setup()
{
    Serial.begin(9600);
    airqualitysensor.init(A0);
}
void loop()
{
    current_quality=airqualitysensor.slope();
    if (current_quality >= 0)// if a valid data returned.
    {
        if (current_quality==0)
            Serial.println("High pollution! Force signal active");
        else if (current_quality==1)
            Serial.println("High pollution!");
        else if (current_quality==2)
            Serial.println("Low pollution!");
        else if (current_quality ==3)
            Serial.println("Fresh air");
    }
}
ISR(TIMER2_OVF_vect)
{
    if(airqualitysensor.counter==122)//set 2 seconds as a detected duty
    {
        airqualitysensor.last_vol=airqualitysensor.first_vol;
        airqualitysensor.first_vol=analogRead(A0);
        airqualitysensor.counter=0;
        airqualitysensor.timer_index=1;
        PORTB=PORTB^0x20;
    }
    else
    {
        airqualitysensor.counter++;
    }
}

I am new in Arduino and I have no clue what to do! Thanks in advance

I'm going to guess that your board doesn't use an AVR.

Why are you using an hourly build?
:o

I am using Seeduino LoRaWAN board to integrate with grove sensor. I have followed this link: Grove - Air Quality Sensor v1.3 - Seeed Wiki

Should I avoid hourly build and dowlonad the latest IDE?

I think that's an ARM processor.

To solve this problem can you suggest me anything that I should do. I am new and no clue how to solve this

Which is more important?
The LoRaWAN or sensor readings?
If the former, you'll need to find (or write) a compatible library, if the latter, just swap to an AVR-based board.

The code was intended for the Seeeduino board, which is compatible with Arduino Uno and the like.

Same problem is with me. Please help!!!

Did you found the solution?

I think you can substitute a two second millis() timer to trigger your readings. Indeed the basic library example for AirQuality.h uses delay() to time the readings.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.