Example of measuring an alcohol sensor

Dependencies:   mbed

Committer:
sam_grove
Date:
Fri Aug 15 21:25:14 2014 +0000
Revision:
0:ac502eed91bf
Initial commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
sam_grove 0:ac502eed91bf 1
sam_grove 0:ac502eed91bf 2 #include "mbed.h"
sam_grove 0:ac502eed91bf 3
sam_grove 0:ac502eed91bf 4 DigitalOut heater(A1);
sam_grove 0:ac502eed91bf 5 AnalogIn sensor(A0);
sam_grove 0:ac502eed91bf 6
sam_grove 0:ac502eed91bf 7 int main(void)
sam_grove 0:ac502eed91bf 8 {
sam_grove 0:ac502eed91bf 9 float value = 0.0f;
sam_grove 0:ac502eed91bf 10 heater = 1;
sam_grove 0:ac502eed91bf 11 wait(0.1f);
sam_grove 0:ac502eed91bf 12
sam_grove 0:ac502eed91bf 13 while(1) {
sam_grove 0:ac502eed91bf 14 heater = 0;
sam_grove 0:ac502eed91bf 15 value = sensor;
sam_grove 0:ac502eed91bf 16 printf("Sensor is: %2.2f\n", value);
sam_grove 0:ac502eed91bf 17 wait(1.0f);
sam_grove 0:ac502eed91bf 18 }
sam_grove 0:ac502eed91bf 19 }