PWM motor controler. Serial DAQ float 0 upto 1

Dependencies:   mbed

Revision:
1:a3dae8744a7d
Parent:
0:d26101f286c4
diff -r d26101f286c4 -r a3dae8744a7d main.cpp
--- a/main.cpp	Fri Jun 24 14:54:11 2016 +0000
+++ b/main.cpp	Fri Jun 24 15:03:59 2016 +0000
@@ -1,28 +1,25 @@
 /*Kamil Kanas 
 Nucleo  PWM to Serial motor controller 
-Tested 24/6/2016
+Rev 1.1
 */
 
 #include "mbed.h"
-#define led_green D13    
-//DigitalOut green(led_green);        
+      
 Serial pc(USBTX,USBRX);
 PwmOut led(D13);
   
-float pwmOut;
+float pwmOut;                                         //PWM port
 char buffer[16];  
 
 int main() {
-    pc.baud(115200);                                  /*Set baud rate*/
+    pc.baud(115200);                                  //Set baud rate
     
-      while (1){
+    while (1){
        led=pwmOut;
-       while(true){
-       if(pc.readable()) {                           /*if data in the ring buffer*/   
+      while(true){
+       if(pc.readable()) {                           //if data in the ring buffer   
          pc.gets(buffer, 8);
           pc.printf("DataReceived %s \n", buffer);  
-          //dataInt = atoi(buffer);
-          //pc.printf("%d \n",dataInt); 
            pwmOut=atof(buffer);
             pc.printf("%2.2f\n",pwmOut);
           break;