Open rusosnith opened 3 years ago
Hey, thanks for the hint.
I indeed forgot about declaring Serial and Serial1.
I wrote the example more or less in a hurry, so I will fix this and push this in a few moments
Well, the problem seems to be rooted deeper inside the code than I thought... May takes a while, seems like ATSam und ATMega are referencing the UART ports by different classes...makes it more complicated to be platform independent
I'm using another code with the library for the MH-Z19b and it seems to be working without any change, in an arduino duemilnuova. Here is the code I'm using and it's working, maybe it helps you find the solution?
https://github.com/jlaliaga/Medidor-de-CO2/releases/download/V2/MHZ19_getppm_OLED_COM_LED_CALIB.ino
A good example on how to use the lib would be awesome for us noobs trying to make CO2 sensors for schools + covid!
Hey,
thanks for the feedback.
I will try to fix this and create a better example ASAP.
But since I'm leading the EMS in our local vaccination center, I don't have that much time at the moment.
I hope you can understand this.
Meanwhile the first release of the lib should work properly (I wrote this lib for my personal use and then decided to publish it, since I found no lib fitting my needs at that time)
Anyway, I will notice you as soon as I have solved the problem.
Stay healthy
Jan-Niklas
Am 9. April 2021 14:43:34 MESZ schrieb andres Snitcofsky @.***>:
I'm using another code with the library for the MH-Z19b and it seems to be working without any change, in an arduino duemilnuova. Here is the code I'm using and it's working, maybe it helps you find the solution?
https://github.com/jlaliaga/Medidor-de-CO2/releases/download/V2/MHZ19_getppm_OLED_COM_LED_CALIB.ino
A good example on how to use the lib would be awesome for us noobs trying to make CO2 sensors for schools + covid!
-- You are receiving this because you commented. Reply to this email directly or view it on GitHub: https://github.com/Jan-NiklasB/MH-Z14A-Library/issues/2#issuecomment-816654948
-- Diese Nachricht wurde von meinem Android-Gerät mit K-9 Mail gesendet.
thanks! keep up with the vaccination!
(what do you mean by "the first release of the lib"? this one right here or some other one?)
If you take a look under releases here on github there is a version 1.0.0 which should be working, since I made a few changes to implement some new functions from the updated manual of the sensor.
The example should be the same, but the lib should work as far as I know...
But I'm not sure if I tested it on the due or the mega2560...
Am 9. April 2021 19:53:26 MESZ schrieb andres Snitcofsky @.***>:
thanks! keep up with the vaccination!
(what do you mean by "the first release of the lib"? this one right here or some other one?)
-- You are receiving this because you commented. Reply to this email directly or view it on GitHub: https://github.com/Jan-NiklasB/MH-Z14A-Library/issues/2#issuecomment-816852978
-- Diese Nachricht wurde von meinem Android-Gerät mit K-9 Mail gesendet.
I created a dev branch with an updated version, would you mind testing it on your setup?
Hi, I'm having the same issues with the serial "serial1 was not declared in the scope". Maybe I'm doing something wrong but when I try to download your library from the arduino environment and the library manager i don't see the example in the examples menu. When i try to manually put it in the libraries folder of the arduino i have to change the example as .ino file and put it in seperate folder but still got the same problem with serial when I try to compile it... Any hints would be appreciated, tnx
Hi, I'm having the same issues with the serial "serial1 was not declared in the scope". Maybe I'm doing something wrong but when I try to download your library from the arduino environment and the library manager i don't see the example in the examples menu. When i try to manually put it in the libraries folder of the arduino i have to change the example as .ino file and put it in seperate folder but still got the same problem with serial when I try to compile it... Any hints would be appreciated, tnx
Hey,
sorry for the late response. The Version currently available in the Arduino IDE is NOT updated yet. So the error described above is still present, as I got no feedback until now, if the changes in the dev-branch are working for other setups than mine.
So I would really appreciate it if you may could test the version in the dev branch on your setup. https://github.com/Jan-NiklasB/MH-Z14A-Library/releases/tag/v1.0.3-beta.1
Let me know if you need help in doing so.
Jan-Niklas
Hi, maybe I'm doing something wrong... When i downloaded the beta version I unzipped it and put it on the libraries folder of the arduino. I copied the example code and made an .ino file . When i try o compile it it says "src/MH-Z14A.h: No such file or directory"
Hi, maybe I'm doing something wrong... When i downloaded the beta version I unzipped it and put it on the libraries folder of the arduino. I copied the example code and made an .ino file . When i try o compile it it says "src/MH-Z14A.h: No such file or directory"
Hey, it's a bit tricky since arduino started using their online lib browser...
In Arduino 1.8.12 (at least in the linux version) you can add a lib by clicking on Sketch-> include Library -> Add .zip library -> choose the zip file you downloaded under the link provided in my last post.
If that won't work, let me know again, then I have to search for another way.
I tested compiling this code and it threw no errors:
#include <Arduino.h>
#include <MH-Z14A.h>
MHZ14A sensor;
void setup() {
// put your setup code here, to run once:
sensor.begin(Serial, 4000);
}
void loop() {
// put your main code here, to run repeatedly:
}
P.S. I also had a wrong version in the lib file, thats corrected now
ok, so far it compiles, but I'm new to this and not really sure how to use it. I mean i only connect the sensor GND, VDD and RX, TX, right?
How should i use the read function in the loop?
Something like this? :
``
void loop() {
Serial.println("CO2 concentration: " + String(sensor.readConcentrationPPM(0x01)) + " ppm");
delay(5000);
}``
Hey,
Nice to hear. Yeah, that should do the job at least for initial testing purposes.
Later on you can use it the way you need it.
If you need further help let me know, I will try my best to help you.
Am 8. Juni 2021 09:22:52 MESZ schrieb vladoya @.***>:
ok, so far it compiles, but I'm new to this and not really sure how to use it. I mean i only connect the sensor GND, VDD and RX, TX, right? How should i use the read function in the loop? Something like this? : `` void loop() { Serial.println("CO2 concentration: " + String(sensor.readConcentrationPPM(0x01)) + " ppm");
delay(5000);}``
-- You are receiving this because you commented. Reply to this email directly or view it on GitHub: https://github.com/Jan-NiklasB/MH-Z14A-Library/issues/2#issuecomment-856524585
-- Diese Nachricht wurde von meinem Android-Gerät mit K-9 Mail gesendet.
well... I try to run this simple program: `
MHZ14A sensor;
void setup() {
// put your setup code here, to run once:
sensor.begin(Serial, 4000);
Serial.begin(115200);
}
void loop() { Serial.println(readConcentrationPPM(0x01)); delay(5000);
`}``
But the arduino says "error: 'readConcentrationPPM' was not declared in this scope" when I try to include it again throws error... It should be working just like in the above, right?
Simple mistake...
Should be sensor.readConcentrationPPM(0x01) as the function is a member of the class MHZ14A
Am 8. Juni 2021 13:59:34 MESZ schrieb vladoya @.***>:
well... I try to run this simple program: `
include
include
MHZ14A sensor; void setup() { // put your setup code here, to run once: sensor.begin(Serial, 4000); Serial.begin(115200);
}void loop() { Serial.println(readConcentrationPPM(0x01)); delay(5000);
`}``
But the arduino says "error: 'readConcentrationPPM' was not declared in this scope" when I try to include it again throws error... It should be working just like in the above, right?
-- You are receiving this because you commented. Reply to this email directly or view it on GitHub: https://github.com/Jan-NiklasB/MH-Z14A-Library/issues/2#issuecomment-856701931
-- Diese Nachricht wurde von meinem Android-Gerät mit K-9 Mail gesendet.
Well thanks a lot. It finally compiles and seams to be working. The strange thing is that the function always returns 2 squares and "y" (the baud of the serial monitor is correct) and the return value is always "-1" But I will play a bit to figure it out. Thanks for the huge help.
Hey nice to hear. I also sometimes get some strange symboles on the serial console directly after connecting.... seems to be more or less normal.
Regarding the return value i'm not completly sure, but it could be that I implemented a return code as error code, so -1 means no error, but i'm not completly sure if that is what you mean.
Am 9. Juni 2021 06:33:26 MESZ schrieb vladoya @.***>:
Well thanks a lot. It finally compiles and seams to be working. The strange thing is that the function always returns 2 squares and "y" (the baud of the serial monitor is correct) and the return value is always "-1" But I will play a bit to figure it out. Thanks for the huge help.
-- You are receiving this because you commented. Reply to this email directly or view it on GitHub: https://github.com/Jan-NiklasB/MH-Z14A-Library/issues/2#issuecomment-857364522
-- Diese Nachricht wurde von meinem Android-Gerät mit K-9 Mail gesendet.
I'm quite a newbie in this, but the example doesnt run
it gives me an error
mh-z14a:4: error: 'Serial1' was not declared in this scope
which is undestundable because Serial1 is indeed not declared anywhere. What should we use instead?