Hello everyone,
I’m using an Arduino UNO, two MCP_9808 temp sensors and a SD Card Module. My SD card is formated and already in FAT32.
My goal is to create a .txt file where i can note every minute the temperature of each sensor.
Here is my code :
#include <Wire.h>
#include "Adafruit_MCP9808.h"
// Create the MCP9808 temperature sensor object
Adafruit_MCP9808 tempsensor_1 = Adafruit_MCP9808();
Adafruit_MCP9808 tempsensor_3 = Adafruit_MCP9808();
void setup() {
Serial.begin(9600);
Serial.println("MCP9808 demo");
Wire.begin();
if (!tempsensor_1.begin(0x18)) {
Serial.println("Couldn't find MCP9808 #1!");
while (1);
}
if (!tempsensor_3.begin(0x1C)) {
Serial.println("Couldn't find MCP9808 #3!");
while (1);
}
}
void loop() {
float c1 = tempsensor_1.readTempC();
float c3 = tempsensor_3.readTempC();
Serial.print(c1); Serial.print(';');
Serial.print(c3) ; Serial.println(';') ;
delay(4000);
}
The code works : I have both temperature in the delay i want (i will fix it at 60sec later) but i made several tests and i don’t know how to code in order to write every minute, in my SD Card those temperature.
Is there a simple code to include in mine please?
Thank you