This is a simple code for detecting the alcohol content of the breath of a person using the alcohol sensor.This MQ3 sensor is used to detect the alcohol content in the air. Sensor Used : MQ3 alcoholmeter. Detection Gas : Alcohol gas Concentration : 0.04-4mg/l alcohol This is an alcohol sensor from futurlec,named MQ-3, which detects ethanol in the air. It is one of the straightforward gas sensors so it works almost the same way with other gas sensors. Typically, it is used as part of the breathalyzers or breath testers for the detection of ethanol in the human breath.

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002  DigitalOut myled(LED1);
00003  AnalogIn alcohol(p16);
00004  
00005 int main() {
00006     while(1) {
00007         if(alcohol>0.7) {
00008           printf("The alcohol percentage in your breath is ! (%f)\n", alcohol.read());             
00009         myled = 1;
00010         wait(4);
00011         myled = 0;
00012         wait(0.2);
00013         }
00014     }
00015 }
00016 
00017 
00018