Skip to content
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

Two sensors MQ131: LOW and HIGH concentration in project #40

Closed
Chris722 opened this issue Jan 23, 2021 · 3 comments
Closed

Two sensors MQ131: LOW and HIGH concentration in project #40

Chris722 opened this issue Jan 23, 2021 · 3 comments
Assignees
Labels
question Further information is requested

Comments

@Chris722
Copy link

Hello ostaquet,

I'd like to connect two MQ131 sensors to Arduino UNO: first - LOW_CONCENTRATION to A0 input and second HIGH_CONCENTRATION to A1 input.
How should I declare them in the program?

Best regards,
KAD

@ostaquet
Copy link
Owner

As you can see in the header file, the sensor is created through the instance of MQ131Class.

In order to have multiple instance of the driver, you just have to instantiate the class more than once.

Per example:

MQ131Class lowSensor = new MQ131Class();
MQ131Class highSensor = new MQ131Class();

lowSensor->begin(...);
highSensor->begin(...);
[...]

@ostaquet ostaquet self-assigned this Mar 13, 2021
@ostaquet ostaquet added the question Further information is requested label Mar 13, 2021
@tbmart16
Copy link

Hi ostaquet,

I have a similar goal of using both a high concentration and low concentration sensor in my program. I see your response above and I tried to implement it into my Arduino code, but I get an error. Should I put your example above before the void setup() or inside of the void setup()?

@Chris722
Copy link
Author

Hi tbmart16,

This code works for me:

#include <MQ131.h>

MQ131Class highSensor = new MQ131Class(8000); # Load resistance RL of 8kOhms (8000 Ohms)
MQ131Class lowSensor = new MQ131Class(1000000); # Looad resistance RL of 1MOhms (1000000 Ohms)

void setup() {
Serial.begin(115200);

highSensor.begin(2,A0, HIGH_CONCENTRATION, 8000, (Stream *)&Serial);
[...]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants