Tuesday, September 27, 2011

Gas Leak Detection

MQ-6 Semiconductor Sensor For LPG





Setting arduino with MQ-6 LPG


This Code
const int analogPin = A0;
const int ledCount = 10;

ledPins int [] = {
2, 3, 4, 5, 6, 7,8,9,10,11};


void setup () {
for (int thisLed = 0; thisLed <ledCount; thisLed + +) {
pinMode (ledPins [thisLed], OUTPUT);
}
}

void loop () {

int sensorReading = analogRead (analogPin);

int ledLevel = map (sensorReading, 0, 1023, 0, ledCount);


for (int thisLed = 0; thisLed <ledCount; thisLed + +) {

if (thisLed <ledLevel) {
digitalWrite (ledPins [thisLed], HIGH);
}

else {
digitalWrite (ledPins [thisLed], LOW);
}
}
}


1 comment:

  1. These diagrams are really helpful to understand the flame detection. Det-tronics sas detection is a high efficient and the most reliable one in this connection.
    http://www.industrialzone.com/3986-gas-detection

    ReplyDelete