EasyManua.ls Logo

Joy-it SEN-MQ4 - Page 4

Joy-it SEN-MQ4
5 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
www.joy-it.net
Pascalstr. 8 47506 Neukirchen-Vluyn
3. COMMISSIONING WITH THE ARDUINO
Arduino MQ4
GND GND (Pin1)
5V VCC (Pin2)
Digital Pin 8 D0 (Pin3)
Analog Pin A0 A0 (Pin4)
Wiring:
Code example:
The higher the analog input signal, the higher the measured natural gas or methane value.
The value range is from 0 to 1023.
The D0 pin of the sensor is automatically set to LOW when the limit value is reached.
With the blue potentiometer on the board, you can set the limit value.
In the following code example, the analog value of the sensor is read out every 5 seconds
and displayed on the serial monitor.
Before uploading, make sure that you have set the correct board and port in your Arduino
IDE.
void setup() {
Serial.begin(9600);
pinMode(A0, INPUT);
pinMode(8, INPUT);
}
void loop() {
if (digitalRead(8)==LOW){
Serial.println("Warning: Limit exceeded!!!");
}
Serial.println(analogRead(A0));
delay(5000);
}