Gabriel Silva
/
LOG
temp logg
Diff: main.cpp
- Revision:
- 4:0e3e93c26d83
- Parent:
- 2:bb274878f482
- Child:
- 5:c2811b726e63
diff -r 23ecb85b6e8b -r 0e3e93c26d83 main.cpp --- a/main.cpp Wed Sep 30 09:59:57 2020 -0400 +++ b/main.cpp Tue Oct 06 09:41:35 2020 -0400 @@ -5,6 +5,8 @@ #include "TMP117.h" #define LOG_DELAY 5 //seconds +#define TMP_QUANT 3 +#define MLX_QUANT 1 DigitalOut myled(LED1); RawSerial pc(USBTX, USBRX); @@ -32,7 +34,7 @@ Mlx90615 mlx; - TMP117 tmp(0x48); + TMP117 tmp(TMP_QUANT); SDBlockDevice blockDevice(MBED_CONF_SD_SPI_MOSI, MBED_CONF_SD_SPI_MISO, MBED_CONF_SD_SPI_CLK, @@ -68,9 +70,19 @@ myled = 1; time_t seconds = time(NULL); float mtemp = mlx.read_temperature(); - float ttemp = tmp.getTemperature(); - printf ("MLX: %.2f Celsius, TMP: %.2f Celsius, %s", mtemp, ttemp, ctime(&seconds)); - fprintf (fp, "MLX: %.2f Celsius, TMP: %.2f Celsius, %s", mtemp, ttemp, ctime(&seconds)); + tmp.getTemperatures(); + + + printf("%s{\nTMP:\n",ctime(&seconds)); + fprintf(fp,"%s{\nTMP:\n",ctime(&seconds)); + for(int i = 0; i < TMP_QUANT; i++) + { + printf("\t%d: %.2f ,", i, tmp.temps[i]); + fprintf(fp, "\t%d: %.2f ,", i, tmp.temps[i]); + } + printf("\n}\n"); + fprintf(fp,"\n}\n"); + fflush(fp); myled = 0;