![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
part1
Dependencies: mbed
Diff: main.cpp
- Revision:
- 4:34df824930f6
- Parent:
- 3:664e38d7ae34
- Child:
- 5:cb200e69a544
diff -r 664e38d7ae34 -r 34df824930f6 main.cpp --- a/main.cpp Tue Feb 17 18:55:46 2015 +0000 +++ b/main.cpp Tue Feb 17 19:22:51 2015 +0000 @@ -25,13 +25,17 @@ { //Input Desired Tone printf("Input Desired Tone: Frequency (Hz) Duration (ms) followed by enter\r"); - char c; - while((c = pc.getc()) != '\r') { + char c = pc.getc(); + int i =0; + while(c != '\r') { printf("%c",c); + input[i++]=c; c = pc.getc(); } - fgets(input, sizeof input, stdin); //input size length 9 followed by enter (xxxx xxxx/r) + input[i] = '\0'; + //fgets(input, sizeof input, stdin); //input size length 9 followed by enter (xxxx xxxx/r) 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)