ECE 4333 / ECE4333Lab2

Dependencies:   mbed

Revision:
0:93a3065ac203
Child:
1:127190419363
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Fri Jan 22 17:59:50 2016 +0000
@@ -0,0 +1,40 @@
+#include "mbed.h"
+
+void main() {
+char Key;
+Initialize();
+while(TRUE) {
+ Key=DisplayMenu();
+ if(Key=='1') SimpleIO();
+ else if(Key=='2') AnalogOutO();
+ else if(Key=='3') AnalogIn();
+ else if(Key=='4') PwmOut();
+ else if(Key=='5') TimerIntInit();
+ else if(Key=='6') ExternalIntInit();
+ else if(Key=='7') LinearOpticalArrayTest();
+ else if(Key=='8') BluetoothTest();
+ else printf("\r\nInvalid keypress entry.\r\n");
+ }
+}
+char DisplayMenu(void){
+char Key;
+disable_interrupts(INT_RTCC);
+disable_interrupts(INT_EXT1);
+disable_interrupts(GLOBAL)
+printf("\n\r\n\r-----Robotics Test Program -----\n\n\r”);
+printf("Type number followed by enter:");
+printf("\n\r 1: Read digital value at XX and write to YY.");
+printf("\n\r 2: Write analog output at XX.");
+printf("\n\r 3: Read analog input at YY and ZZ.");
+printf("\n\r 4: PWM output at XX.");
+printf("\n\r 5: Timer interrupt generation.");
+printf("\n\r 6: External interrupt generation.");
+printf("\n\r 7: Linear optical array test.");
+printf("\n\r 8: Bluetooth communication.\n\r");
+printf("Keypress = ");
+Key=0x7F & getc();
+printf("\n\r-------------------------------------");
+printf("\r\nPressed Key = %C",Key);
+printf("\n\r-------------------------------------");
+return(Key);
+}