Paso 5: Nuestro código
int mq3_digitalPin = 13; conectado al pin de salida de MQ3
const int led1 = 2; se trata de las colocaciones de led
const int led2 = 3;
const int led3 = 4;
const int led4 = 5;
const int led5 = 6;
const int led6 = 7;
const int led7 = 8;
const int led8 = 9;
const int led9 = 10;
const int led10 = 11;
void setup() {}
Serial.Begin(9600); abrir serial a 9600 bps
pinMode (mq3_digitalPin, entrada);
pinMode (led1, salida);
pinMode (led2, salida);
pinMode (led3, salida);
pinMode (led4, salida);
pinMode (led5, salida);
pinMode (led6, salida);
pinMode (led7, salida);
pinMode (led8, salida);
pinMode (led9, salida);
pinMode (led10, salida);
}
void loop()
{
int mq3_value = digitalRead(mq3_digitalPin);
Serial.println(mq3_value);
Delay(100); frenar la salida de
Si (mq3_value > = 0) {//lighting LED para lectura de alcohol
digitalWrite (LED 1, HIGH);
}
Si (mq3_value > = 1) {}
digitalWrite (led2, HIGH);
}
Si (mq3_value > = 3) {}
digitalWrite (LED 3, alto);
}
Si (mq3_value > = 6) {}
digitalWrite (led4, HIGH);
}
Si (mq3_value > = 9) {}
digitalWrite (led5, HIGH);
}
Si (mq3_value > = 12) {}
digitalWrite (led6, HIGH);
}
Si (mq3_value > = 15) {}
digitalWrite (led7, HIGH);
}
Si (mq3_value > = 18) {}
digitalWrite (led8, HIGH);
}
Si (mq3_value > = 21) {}
digitalWrite (led9, HIGH);
}
Si (mq3_value > = 24) {}
digitalWrite (led10, HIGH);
}
}