Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: 4DGL-uLCD-SE AD5206 mbed-rtos mbed
Fork of 4180_proj by
Revision 13:4cec0e446def, committed 2015-12-07
- Comitter:
- hanjiex
- Date:
- Mon Dec 07 18:41:29 2015 +0000
- Parent:
- 12:b6265952fb06
- Commit message:
- 111
Changed in this revision
diff -r b6265952fb06 -r 4cec0e446def main.cpp
--- a/main.cpp Mon Dec 07 18:14:51 2015 +0000
+++ b/main.cpp Mon Dec 07 18:41:29 2015 +0000
@@ -33,8 +33,11 @@
int vol;
int main(void){
+
int start = begain_first();
- if (start) {
+ if (start == 0) {
+ }
+ if (start == 1) {
while (1) {
thispara = para_setting();
int type=thispara.get_type();
diff -r b6265952fb06 -r 4cec0e446def menu.cpp
--- a/menu.cpp Mon Dec 07 18:14:51 2015 +0000
+++ b/menu.cpp Mon Dec 07 18:41:29 2015 +0000
@@ -21,6 +21,7 @@
DigitalOut led2(LED2);
DigitalOut led3(LED3);
DigitalOut led4(LED4);
+DigitalIn pb(p21);
/*
DigitalIn left_pb1(p21);
DigitalIn right_pb1(p23);
@@ -57,6 +58,8 @@
}
int begain_first(){
+ int mode;
+ pb.mode(PullUp);
/*
left_pb1.mode(PullUp);
right_pb1.mode(PullUp);
@@ -64,8 +67,8 @@
toggle_pb1.mode(PullUp);*/
interrupt.fall(&fallInterrupt);
interrupt.mode(PullUp);
- display_beginning();
- while(1){
+ mode = display_beginning();
+ while(mode == 1){
display_main_menu();
choose();
check();
@@ -73,7 +76,10 @@
break;
}
}
- return 1;
+ while (mode == 0) {
+ uLCD.printf("PC MODE");
+ }
+ return mode;
}
int return_menu(){
@@ -89,7 +95,7 @@
}
}
-void display_beginning(){
+int display_beginning(){
uLCD.color(RED);
uLCD.printf("\nWelcome\n"); //Default Green on black text
uLCD.printf("\nTo\n"); //Default Green on black text
@@ -97,10 +103,29 @@
uLCD.printf("\nFunction Genator!\n");
wait(2);
uLCD.cls();
-
+ uLCD.printf("\nChoose your control mode\n");
+ uLCD.locate(0,5);
+ uLCD.printf("\n1. mbed mode\n");
+ uLCD.locate(0,7);
+ uLCD.printf("\n2. PC mode\n");
+ int choose = 0;
+ int mode = 0;
+ while(choose == 0){
+ //pc.printf("\nkeypress is: %d\n", keypress);
+ if (keypress == 1) {
+ choose = 1;
+ mode = 1;
+ }
+ if (keypress == 2) {
+ choose = 1;
+ mode = 0;
+ }
+ }
+ return mode;
}
void display_main_menu(){
+ uLCD.cls();
uLCD.color(GREEN);
uLCD.locate(0,3);
uLCD.printf("\n1. Let's Start!\n");
diff -r b6265952fb06 -r 4cec0e446def menu.h
--- a/menu.h Mon Dec 07 18:14:51 2015 +0000
+++ b/menu.h Mon Dec 07 18:41:29 2015 +0000
@@ -10,8 +10,7 @@
int begain_first();
int return_menu();
-
-void display_beginning();
+int display_beginning();
void display_main_menu();
