-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Read sensor's data in separate function (out of main loop) #32
Comments
Just found out working sketch (look at the commented lines): #include <pms.h> PmsAltSerial pmsSerial; // * PMS5003 Pin 1 : VCC +5V // if PMS5003 Pin 3 and PMS5003 Pin 3 are not connected // if PMS5003 Pin 3 and PMS5003 Pin 3 are connected //////////////////////////////////////// void setup(void) { if (!pms.begin()) { pms.setPinReset(pinReset); if (!pms.write(PmsCmd::CMD_RESET)) { Serial.print("Time of setup(): "); //////////////////////////////////////// void loop(void) { void readPMS() { switch (status) {
} |
If I use pm01basic sketch it works fine. But if I move read procedure out of void loop(void) to new readPMS() function I receiving CRC Error quite often. Even more: after 10 - 15 minutes I receiving "Pms error: CRC Error" all the time.
How can I move read procedure out of main loop?
Thank You!
The text was updated successfully, but these errors were encountered: