Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
void getTemp()
{
if(currentMillis-tempMillis >= tempDelay) {
float tempc;
float tempc2;
//char buffer[10];
DS18B20.requestTemperatures();
tempc = DS18B20.getTempCByIndex(0);
tempc2 = DS18B20.getTempCByIndex(1);
temp=(tempc*9/5+32); //converted to F.
temp2=(tempc2*9/5+32); //converted to F.
//String tempC = dtostrf(temp, 4, 1, buffer);//handled in sendTemp()
//Serial.print("Temperature: ");
//Serial.print(String(sent)+" Temperature: ");
Serial.print("Uploaded temp to file: ");
Serial.println(temp);
tempMillis = currentMillis;
File tempLog = SPIFFS.open("/temp.csv", "a"); // Write the time and the temperature to the csv file
tempLog.print(currentMillis);
tempLog.print(',');
tempLog.println(temp);
tempLog.close();
}
}
<html>
<head>
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<script type="text/javascript">
google.charts.load('current', {'packages':['gauge']});
google.charts.setOnLoadCallback(drawChart);
function drawChart() {
var data = google.visualization.arrayToDataTable([
['Label', 'Value'],
['Temp F', 80],
['CPU', 55],
['Network', 68]
]);
var options = {
width: 600, height: 320,
redFrom: 90, redTo: 100,
yellowFrom:75, yellowTo: 90,
minorTicks: 5
};
var chart = new google.visualization.Gauge(document.getElementById('chart_div'));
chart.draw(data, options);
setInterval(function() {
data.setValue(25);
chart.draw(data, options);
}, 13000);
setInterval(function() {
data.setValue(1, 1, 40 + Math.round(60 * Math.random()));
chart.draw(data, options);
}, 5000);
setInterval(function() {
data.setValue(2, 1, 60 + Math.round(20 * Math.random()));
chart.draw(data, options);
}, 26000);
}
</script>
</head>
<body>
“<p>This is still a work in progress.</p>”
<div id="chart_div" style="width: 400px; height: 120px;"></div>
</body>
</html>
I see your code uses spiffs as the data logger memory, I just use ram on my weatherstation further up.
Which is better to use?
I'll see if I can follow along on that tutorial. It is alot of trial and error at this point in the project
Sounds like I need an SD card or add another memory chip/option for the long term solution (greater than a year). I'll dig through the web some and see what others are doing. I'll have some time this weekend to see if I can start serving data from spiffs to the webpage when it is requested.