Paso 3: Código de ejemplo
#include#define aref_voltage 3
const int tmpPin = A2;
buffer de Char [50];
int tmpReading;
void setup() {}
}
void loop() {}
tmpReading = analogRead(tmpPin);
printf ("tmpReading = %d\n",tmpReading);
voltaje del flotador = tmpReading * aref_voltage;
voltaje = 4096;
flotador tmpC = (voltaje - 0.5) * 100;
sprintf (buffer, "{\"value\":%4.2f}\n", tmpC);
FILE * fp = fopen ("/ home/ubuntu/datafile.txt","w+");
fwrite (buffer, sizeof(char), strlen(buffer), fp);
fclose (fp);
Exit (0);
}