-
Notifications
You must be signed in to change notification settings - Fork 0
/
MQ-6 LPG Gas Sensor.ino
35 lines (16 loc) · 946 Bytes
/
MQ-6 LPG Gas Sensor.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
void setup()
{
Serial.begin(9600); // Start Serial Communication/ Baud Rate
}
/* This Particular Function is used for Repeated Execution of the Circuit until Specified. */
void loop()
{
float sensorVoltage; // Initialize Variable for Sensor Voltage
float sensorValue; // Initialize Variable for Sensor Value
sensorValue = analogRead(A0); // Read the Sensor Values from Analog Pin A0
sensorVoltage = sensorValue/1024*5.0; // Calculate the Sensor Voltage
Serial.print("sensor voltage = "); // Print the Message
Serial.print(sensorVoltage); // Print the Values
Serial.println(" V"); // Print the Message
delay(1000); // Wait for 1000 ms
}