F
Dependencies: mbed Sht31 MAX44009
Revision 12:5a140bcc456f, committed 2020-04-25
- Comitter:
- kentwong
- Date:
- Sat Apr 25 06:41:27 2020 +0000
- Parent:
- 11:3a63d6f65ff5
- Child:
- 13:7da5ad2bd3c6
- Commit message:
- why u have to go and make things so complicated?
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Fri Apr 24 18:09:32 2020 +0000
+++ b/main.cpp Sat Apr 25 06:41:27 2020 +0000
@@ -237,7 +237,7 @@
BLE_Can_receive = 0;
counter++;
- if (counter == 10 &&_30Scounter==2){
+ if (counter == 10 &&_30Scounter==0){
_30Scounter=0;
// pc.printf("%u,%u\n",(unsigned short)(luxavg*1000),(unsigned short)(second*1000));
sleepData[sleepDataPos].timestamp=(int)seconds;
@@ -254,11 +254,18 @@
BLE_Can_receive = 1;
if (wrote){
if (signal[0]=='s'){
- for (int i=0;i <sleepDataPos;i++){
- float tempL=sleepData[i].light/1000.0f;
- float tempN=sleepData[i].noise/1000.0f;
- pc.printf("[%d,%f,%f]\n",sleepData[i].timestamp,tempL,tempN);
+ for (int i=0;i <=sleepDataPos;i++){
+ if (i==sleepDataPos){
+ wait_ms(500);
+ pc.printf("\"send\"");
+ }
+ else {
+ float tempL=sleepData[i].light/1000.0f;
+ float tempN=sleepData[i].noise/1000.0f;
+ pc.printf("[\"%d\",\"%f\",\"%f\"],",sleepData[i].timestamp,tempL,tempN);
+ }
}
+ sleepDataPos=0;
wrote=false;
}
else
@@ -267,10 +274,12 @@
pc.printf("%d,%d,%d,%d,%d,%3.2f,%3.2f%,%0.001f,%f\n",sendCounter,(int)(RGBavg.C+0.5), (int)(RGBavg.R+0.5), (int)(RGBavg.G+0.5), (int)(RGBavg.B+0.5),THavg.t, THavg.h,luxavg,second);
if (sendCounter == 10){ //10 = all element is filled {
if (signal[0]=='i'){
+ wait_ms(500);
pc.printf("end");
}
else if (signal[0]=='a')
{
+ wait_ms(500);
pc.printf("aend");
}
sendCounter=0;