Go Down

Topic: MKR1000 problem with ISR (Read 119 times) previous topic - next topic

HerKnab

Hello  :(

I'm using an MKR1000 an tried to get a simple gas-sensor from Grove to work.
With my ArduinoUno I had no problems, but with the new MKR1000 I got this error:


AirQuality_Sensor:30: error: expected constructor, destructor, or type conversion before '(' token

ISR(TIMER1_OVF_vect)


That's the exmaple code:
Code: [Select]
/*
  AirQuality Demo V1.0.
  connect to A0 to start testing. it will needs about 20s to start
* By: http://www.seeedstudio.com
*/
#include"AirQuality.h"
#include"Arduino.h"
AirQuality airqualitysensor;
int current_quality =-1;
void setup()
{
    Serial.begin(9600);
    airqualitysensor.init(14);
}
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(TIMER1_OVF_vect)
{
if(airqualitysensor.counter==61)//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++;
}
}

   

Arduino: 1.6.9 (Windows 7), Board: "Arduino/Genuino MKR1000".

Greatings from Germany

Ballscrewbob

Can you link me to the library you used please.
Karma is the difference between your enemy getting whacked by somebody else, or buying a baseball bat and finding a dark alley. The latter gives more pleasure.

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy