Seeed-Studio / Grove_Air_quality_Sensor

test for air quality
MIT License
21 stars 16 forks source link

Working with Arduino Leonardo #8

Open omarecd opened 4 years ago

omarecd commented 4 years ago

Dear team. Thanks for the great work with the sensor.

Question: To test that everything worked fine, I started with the example provided on the library. When I compile for the board Arduino Uno it works, however when I compile for the Arduino Leonardo, it doesn't work (I should use Leonardo for my project).

Ps. I also trying modifying the .cpp file, replacing the current values (like TCCR2A) by the proposed values (TCCR0A). Then, compilation was "ok", however the sensor is not behaving as expected. Any ideas? Thanks.

================= Error msg starts like that:

Arduino: 1.8.10 (Linux), Board: "Arduino Leonardo"

In file included from /home/o/Downloads/arduino-1.8.10/hardware/arduino/avr/cores/arduino/Arduino.h:30:0, from /home/o/Arduino/libraries/Grove_-_Air_qualitysensor/AirQuality.h:23, from /home/o/Arduino/libraries/Grove-_Air_quality_sensor/examples/AirQuality_Sensor/AirQualitySensor.ino:6: /home/o/Arduino/libraries/Grove-_Air_quality_sensor/examples/AirQuality_Sensor/AirQuality_Sensor.ino: In function 'void TIMER2_OVFvect()': /home/o/Arduino/libraries/Grove-_Air_quality_sensor/examples/AirQuality_Sensor/AirQuality_Sensor.ino:30:5: warning: 'TIMER2_OVF_vect' appears to be a misspelled 'signal' handler, missing '__vector' prefix [-Wmisspelled-isr] ISR(TIMER2_OVFvect) ^ /home/o/Arduino/libraries/Grove-_Air_qualitysensor/AirQuality.cpp: In member function 'void AirQuality::init(int)': /home/o/Arduino/libraries/Grove-_Air_qualitysensor/AirQuality.cpp:80:5: error: 'TCCR2A' was not declared in this scope TCCR2A=0;//normal model ^~ /home/o/Arduino/libraries/Grove-_Air_quality_sensor/AirQuality.cpp:80:5: note: suggested alternative: 'TCCR0A' TCCR2A=0;//normal model ^~ TCCR0A

Pillar1989 commented 4 years ago

I looked at the code and it wasn't on our GitHub. @omarecd

albtrentadue commented 2 years ago

@omarecd please check issue #9. I bet that now the library should work also for Leonardo