mbed ADC read gas sensor

Revision:
0:2e74e9d97542
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Oct 20 12:31:28 2016 +0000
@@ -0,0 +1,16 @@
+// using NuMaker-PFM-NUC472 ADC0 (A0/PE_1) to read gas sensor (MQ-3)
+#include "mbed.h"
+
+AnalogIn   adc0(PE_1); // A0 connected to MQ-3 gas sensor
+DigitalOut led(LED1);
+
+int main(void)
+{
+    printf("ADC0 start reading...\n\r");
+    while (1) { 
+        printf("ADC0 value= 0x%4x, percentage= %3.3f%%\n\r",adc0.read_u16(), adc0.read()*100.0f);
+        if(adc0 > 0.7f) led = 0; // > 0.7 * Vcc wil turn on led
+        else            led = 1;
+        wait(0.2f);
+    }
+}