Example of measuring an alcohol sensor

Dependencies:   mbed

main.cpp

Committer:
sam_grove
Date:
2014-08-15
Revision:
0:ac502eed91bf

File content as of revision 0:ac502eed91bf:


#include "mbed.h"

DigitalOut heater(A1);
AnalogIn sensor(A0);

int main(void)
{
    float value = 0.0f;
    heater = 1;
    wait(0.1f);
    
    while(1) {
        heater = 0;
        value = sensor;
        printf("Sensor is: %2.2f\n", value);
        wait(1.0f);
    }
}