dsadd
Dependencies: mbed Sht31 MAX44009
Revision 8:cca99ce7c5bc, committed 2020-04-24
- Comitter:
- kentwong
- Date:
- Fri Apr 24 04:10:14 2020 +0000
- Parent:
- 7:e4984029012e
- Child:
- 9:7c53c49afa40
- Commit message:
- ver2
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Fri Apr 24 03:57:46 2020 +0000
+++ b/main.cpp Fri Apr 24 04:10:14 2020 +0000
@@ -44,12 +44,12 @@
bool wrote=false;
DigitalOut led(LED1);
char signal[1];
-LocalFileSystem local("local"); //Create the local filesystem under the name "local"
+//LocalFileSystem local("local"); //Create the local filesystem under the name "local"
int main()
{
- set_time(1587699064);
+ // set_time(1587699064);
//pc.read
pc.baud ( 19200 );
@@ -59,7 +59,7 @@
while(1) {
counter = counter%10;
- time_t seconds = time(NULL);
+ //time_t seconds = time(NULL);
{
int sensor_addr = 41 << 1;
char id_regval[1] = {146};
@@ -196,21 +196,22 @@
// pc.printf("Shine Like:%s,%d,%d,%d,%d,%3.2f,%3.2f%,%0.001f\n",signal,(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);
BLE_Can_receive = 0;
counter++;
- if (counter == 10 &&_30Scounter==3){
- _30Scounter=0;
- FILE *fp = fopen("/local/out.txt", "a");
- fprintf(fp, "[%d,%d,%d,%d,%d,%d,%d,%0.001f],\n",seconds,(int)(RGBavg.C+0.5),
- (int)(RGBavg.R+0.5), (int)(RGBavg.G+0.5), (int)(RGBavg.B+0.5),(int)THavg.t,(int) THavg.h,luxavg);
- fclose(fp);
- allfilled = true;
- }
- else if (counter==10){
- _30Scounter++;
+ // if (counter == 10 &&_30Scounter==3){
+ //_30Scounter=0;
+ // FILE *fp = fopen("/local/out.txt", "a");
+ //fprintf(fp, "[%d,%d,%d,%d,%d,%d,%d,%0.001f],\n",seconds,(int)(RGBavg.C+0.5),
+ // (int)(RGBavg.R+0.5), (int)(RGBavg.G+0.5), (int)(RGBavg.B+0.5),(int)THavg.t,(int) THavg.h,luxavg);
+ // fclose(fp);
+ // allfilled = true;
+ // }
+ //else
+ if (counter==10){
+ // _30Scounter++;
allfilled = true;
}
BLE_Can_receive = 1;
if (wrote){
- if (signal[0]=='s'){
+ /* if (signal[0]=='s'){
FILE *fp = fopen("/local/out.txt", "r");
char str[45];
while(!feof(fp))
@@ -221,7 +222,8 @@
fclose(fp);
wrote=false;
}
- else {
+ else */
+ {
sendCounter++;
pc.printf("%d,%d,%d,%d,%d,%3.2f,%3.2f%,%0.001f\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);
if (sendCounter == 10){ //10 = all element is filled {