lyre liu / Mbed 2 deprecated project1

Dependencies:   mbed

Revision:
1:d9a739fe837e
Parent:
0:d6ad48301389
Child:
2:65d319447726
--- a/main.cpp	Sun Mar 06 11:28:55 2016 +0000
+++ b/main.cpp	Sun Mar 06 11:38:08 2016 +0000
@@ -1,5 +1,5 @@
 #include "mbed.h"
-
+#define RATIO 1                      //The amplified factor of the OA  ??????????????????????????????????????????????????
 void MassCompute(float);            // The function of computing mass from voltage.
 void SerialInit(void);              // The function fo serial initial
 void SerialTransmit(void);          // Transmit the data through the serial
@@ -24,12 +24,12 @@
 
 void MassCompute(float voltage)
 {
-    float ratio;                    //The amplified factor of the OA
+    //float ratio;                    //The amplified factor of the OA
     float vol_ref;                  //Reference voltage, the basic voltage of the MCU, the default number is 3.3
     
     vol_ref = 3.3;
     
-    mass = 3000*vol_ref*voltage/ratio + 0.3;        //The compute function of mass from the voltage
+    mass = 3000*vol_ref*voltage/RATIO + 0.3;        //The compute function of mass from the voltage
 }
 
 void SerialInit(void)