Freedom Seeed Grove Alcohol Example

Dependencies:   mbed

Fork of frdm_Grove_Alcohol_Example by Freescale

Simply Import this Program into your mbed compiler
Select Compile to generate the binary file
Open an Hyperterminal window and connect to the mbed Serial Port (COMxx) peripheral using speed 9600bps
Plug the Grove Shield v2 on the top of your FRDM-K64F
Connect on end of the 4-pin Grove cable to Alcohol module and the other end to the port A0 of the Grove Adapter.

/media/uploads/GregC/alcohol1.jpg

Drag n drop the frdm_Grove_Alcohol_Example_K64F.bin into the mbed drive from your file explorer
Wait for download to complete
Press the Reset/SW1 button of your FRDM-K64F board to launch the program

Your hyperterminal window should now display the measurements of the alcohol sensor (see picture below)!!

/media/uploads/GregC/alcohol2.jpg

Committer:
GregC
Date:
Fri Jan 01 17:36:59 2016 +0000
Revision:
0:e146b1cba381
Freedom Seeed Grove Alcohol Example

Who changed what in which revision?

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