ECE 4333 / ECE4333Lab2

Dependencies:   mbed

Revision:
6:2db8f8299773
Parent:
5:6f51a96a5094
Child:
7:3ad02c0c93a9
--- a/main.cpp	Thu Jan 28 17:45:01 2016 +0000
+++ b/main.cpp	Thu Jan 28 18:24:39 2016 +0000
@@ -33,8 +33,9 @@
     printf("\n\r 6: External interrupt generation.");
     printf("\n\r 7: Linear optical array test.");
     printf("\n\r 8: Bluetooth communication.");
-    printf("\n\r Keypress = ");
+    printf("\n\r Keypress = "); 
     Key=0x7F & pc.getc();
+    wait_ms(100);
     printf("\n\r-------------------------------------");
     printf("\r\n Pressed Key = %C",Key);
     printf("\n\r-------------------------------------");
@@ -55,7 +56,7 @@
     printf("\n\r Keypress = ");
     Key=0x7F & pc.getc();
     printf("\n\r-------------------------------------");
-    printf("\r\n Pressed Key = %C",Key);
+    printf("\r\n Pressed Key = %s",Key);
     printf("\n\r-------------------------------------");
     AOutput.write(Key);
 }
@@ -69,17 +70,22 @@
 int PWMOut(){
     
     //Specify Period First
-    
     float T;
     float PW;
-    printf("\n\r\n\r-----Robotics PWM Options-----\n\n\r");
-    printf("Type the period in seconds:");
-    printf("\n\rKeypress = ");
-    T =0x7F & pc.getc();
+    printf("\n\r\n\r-----Robotics PWM Options-----");
+    printf("\n\rEnter a Period in Seconds:");
+    pc.scanf("%f",&T);
     PWM.period(T);
-    printf("\n\r Enter the pulse width in milliseconds.");
-    PW=0x7F & pc.getc();
+    wait_ms(100);
+    printf("\n\rEnter a Pulse Width in Seconds:");
+    pc.scanf("%f",&PW);
     PWM.pulsewidth(PW);
+    wait_ms(100);
+    printf("\n\rPeriod in Seconds: %f", T);
+    printf("\n\rPulse Width in Seconds: %f", PW);
+    
+    
+    
 }
 
 int ExternalIntInit(){//initialize an external interrupt that causes an LED to toggle its state each
@@ -144,7 +150,7 @@
 while(1) {
  Key=DisplayMenu();
  if(Key=='1') SimpleIO();                       //LAB 2.2
-else if(Key=='2') AOut();                       //LAB 2.3
+ else if(Key=='2') AOut();                       //LAB 2.3
  else if(Key=='3') fAnalogIn();                 //LAB 2.4
  else if(Key=='4') PWMOut();                   //LAB 2.5
  else if(Key=='5') TimerIntInit();              //LAB 2.6