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: LCD_fonts SPI_TFT_ILI9341 CMSIS_DSP_401_without_cm4 mbed-src SDFileSystem wavfile
Diff: main.cpp
- Revision:
- 11:737a2367af3c
- Parent:
- 10:0986108f8aa3
- Child:
- 12:ed94d67bd36b
diff -r 0986108f8aa3 -r 737a2367af3c main.cpp
--- a/main.cpp Sun Dec 13 17:58:10 2015 +0000
+++ b/main.cpp Sun Dec 13 18:23:04 2015 +0000
@@ -199,8 +199,8 @@
pu = ain1.read();
pd = ain2.read();
ps = ain3.read();
- if (pd==1) { wait(0.5); menu=1; }
- if (ps==1) { wait(0.5); TFT.cls(); stage=1; }
+ if (pd==1) { wait(0.3); menu=1; }
+ if (ps==1) { wait(0.3); TFT.cls(); stage=1; }
}
if (menu==1) { //waveform
@@ -210,9 +210,9 @@
pu = ain1.read();
pd = ain2.read();
ps = ain3.read();
- if (pu==1) { wait(0.5); menu=0; }
- if (pd==1) { wait(0.5); menu=2; }
- if (ps==1) { wait(0.5); TFT.cls(); stage=2; }
+ if (pu==1) { wait(0.3); menu=0; }
+ if (pd==1) { wait(0.3); menu=2; }
+ if (ps==1) { wait(0.3); TFT.cls(); stage=2; }
}
if (menu==2) { //log
@@ -222,9 +222,9 @@
pu = ain1.read();
pd = ain2.read();
ps = ain3.read();
- if (pu==1) { wait(0.5); menu=1; }
- if ((pd==1)&&(set==1)) { wait(0.5); menu=3; }
- if (ps==1) { wait(0.5); TFT.cls(); stage=3; }
+ if (pu==1) { wait(0.3); menu=1; }
+ if ((pd==1)&&(set==1)) { wait(0.3); menu=3; }
+ if (ps==1) { wait(0.3); TFT.cls(); stage=3; }
}
if (menu==3) { //START
@@ -233,8 +233,8 @@
pu = ain1.read();
pd = ain2.read();
ps = ain3.read();
- if (pu==1) { wait(0.5); menu=2; }
- if (ps==1) { wait(0.5); TFT.cls(); stage=5; }
+ if (pu==1) { wait(0.3); menu=2; }
+ if (ps==1) { wait(0.3); TFT.cls(); stage=5; }
}
}
@@ -302,9 +302,9 @@
pu = ain1.read();
pd = ain2.read();
ps = ain3.read();
- if (pu==1) { wait(0.5); i=ib; }
- if (pd==1) { wait(0.5); i=ia; }
- if (ps==1) { wait(0.5); config=1; }
+ if (pu==1) { wait(0.3); i=ib; }
+ if (pd==1) { wait(0.3); i=ia; }
+ if (ps==1) { wait(0.3); config=1; }
}
if (config==1) { //min
TFT.rect(22,115, 68,145,Olive);
@@ -313,9 +313,9 @@
pu = ain1.read();
pd = ain2.read();
ps = ain3.read();
- if (pu==1) { wait(0.5); j=jb; }
- if (pd==1) { wait(0.5); j=ja; }
- if (ps==1) { wait(0.5); config=2; }
+ if (pu==1) { wait(0.3); j=jb; }
+ if (pd==1) { wait(0.3); j=ja; }
+ if (ps==1) { wait(0.3); config=2; }
}
if (config==2) { //Record Control
TFT.rect(22,115, 68,145,Olive);
@@ -326,9 +326,9 @@
pu = ain1.read();
pd = ain2.read();
ps = ain3.read();
- if (pu==1) { wait(0.5); config=0; }
- if (pd==1) { wait(0.5); config=3; }
- if (ps==1) { wait(0.5); TFT.cls(); stage=4; }
+ if (pu==1) { wait(0.3); config=0; }
+ if (pd==1) { wait(0.3); config=3; }
+ if (ps==1) { wait(0.3); TFT.cls(); stage=4; }
}
if (config==3) { //set
TFT.rect(5,195, 230,225,Olive);
@@ -337,9 +337,9 @@
pu = ain1.read();
pd = ain2.read();
ps = ain3.read();
- if (pu==1) { wait(0.5); config=2; }
- if (pd==1) { wait(0.5); config=4; }
- if (ps==1) { wait(0.5); TFT.cls();
+ if (pu==1) { wait(0.3); config=2; }
+ if (pd==1) { wait(0.3); config=4; }
+ if (ps==1) { wait(0.3); TFT.cls();
if ((i!=0) || (j!=0))
{ h=i; m=j; set=1; }
stage=0;
@@ -352,9 +352,9 @@
pu = ain1.read();
pd = ain2.read();
ps = ain3.read();
- if (pu==1) { wait(0.5); config=3; }
- if (pd==1) { wait(0.5); config=4; }
- if (ps==1) { wait(0.5); TFT.cls(); stage=0; }
+ if (pu==1) { wait(0.3); config=3; }
+ if (pd==1) { wait(0.3); config=4; }
+ if (ps==1) { wait(0.3); TFT.cls(); stage=0; }
}
}
}
@@ -388,7 +388,7 @@
printf("Return");
TFT.rect(150,265,220,285,Green);
ps = ain3.read();
- if (ps==1) { wait(0.5); TFT.cls(); stage=0; }
+ if (ps==1) { wait(0.3); TFT.cls(); stage=0; }
}
if (stage==3) { //log
@@ -403,17 +403,12 @@
sd.write_validation(true);
//Try to mount the SD card
- TFT.locate(10,50);
- TFT.printf("Mounting SD card...");
- TFT.locate(10,60);
int row = 50;
int col = 10;
TFT.locate(10,row); TFT.printf("Mounting SD card..."); row+=10;
if (sd.mount() != 0) {
- TFT.printf("failed!");
TFT.locate(10,row); TFT.printf("failed!"); row+=10;
} else {
- TFT.printf("mounted successfully!\r\n");
TFT.locate(10,row); TFT.printf("mounted successfully"); row+=10;
// write event to log
@@ -422,10 +417,8 @@
if (fp != NULL) {
fprintf(fp, "eureka!\r\n");
fclose(fp);
- TFT.printf("success!\n");
TFT.locate(10,row); TFT.printf("success"); row+=10;
} else {
- TFT.printf("failed!\n");
TFT.locate(10,row); TFT.printf("failed to write"); row+=10;
}
sd.unmount();
@@ -443,13 +436,15 @@
skywire.printf("AT#SGACT=1,1\r\n"); // context activation (returns with IP address)
WaitForResponse("#SGACT");
WaitForResponse("OK");
+ TFT.locate(10,row); TFT.printf("Connected to the Network"); row+=10;
TFT.locate(165,270);
printf("Return");
TFT.rect(150,265,220,285,Green);
-
- ps = ain3.read();
- if (ps==1) { wait(0.5); TFT.cls(); stage=0; }
+ while(1)
+ { ps = ain3.read();
+ if (ps==1) { wait(0.3); TFT.cls(); stage=0; break; }
+ }
}
if (stage==4) //recording... for comparison
@@ -529,7 +524,7 @@
for ( t1=0; t1<t; t1++)
{ ps = ain3.read();
- if (ps==1) { wait(0.5); TFT.cls(); stage=0; }
+ if (ps==1) { wait(0.3); TFT.cls(); stage=0; }
else { wait(1); }
}
}