part1

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
psahay
Date:
Sun Feb 22 20:30:58 2015 +0000
Parent:
8:8991b0b82440
Commit message:
minor changes

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Sun Feb 22 17:54:07 2015 +0000
+++ b/main.cpp	Sun Feb 22 20:30:58 2015 +0000
@@ -1,5 +1,4 @@
 #include "mbed.h"
-//Right now this is only working for inputs length 3
 
 //Initialize PWM
 PwmOut PWM1(p21);
@@ -19,10 +18,8 @@
     //Check if input is valid
     int isint;
     while(1){
-         
             //wait for a valid input
-            while(isint != 2) 
-            {
+            while(isint != 2) {
                 //Input Desired Tone
                 printf("Input Desired Tone: Frequency (Hz) Duration (ms) followed by enter\r");
                 char c = pc.getc();
@@ -36,15 +33,11 @@
                     }
                     input[i] = '\0';    //end buffer
                 isint = sscanf(input, "%f %d",&freq,&dur);      //assign input variables
-                
                 //printf("isint = %d\r",isint); //debug check if input is correct
                 //if input is incorrect this will be displayed
                 if(isint!= 2)
                 printf("You did not enter a number.Please enter an argument's number\r");
-            
             }
-        
-        
           //wait for another enter to output the tone
           if(pc.readable()) {
               //if enter is pressed continue to output tone
@@ -64,13 +57,11 @@
                     //WAIT
                     }
                 PWM1=0.0;                         //turn off
-                t1.stop();
-                
+                t1.stop();    
              }
-             
             //if another button is pressed besides enter abort and start over
              else{
-                printf("You didn't press enter you idiot\r");
+                printf("You didn't press enter\r");
                 isint = 0;  
                  }
             }