web chat
This commit is contained in:
239
JavaScript/adruino-temp-sensor/client/history.csv
Normal file
239
JavaScript/adruino-temp-sensor/client/history.csv
Normal file
@@ -0,0 +1,239 @@
|
||||
time,temperature
|
||||
2018-7-22 14:05:38,27
|
||||
2018-7-22 14:06:38,27
|
||||
2018-7-22 14:07:38,28
|
||||
2018-7-22 14:08:38,28
|
||||
2018-7-22 14:09:38,28
|
||||
2018-7-22 14:10:38,28
|
||||
2018-7-22 14:11:38,28
|
||||
2018-7-22 14:12:38,28
|
||||
2018-7-22 14:13:38,28
|
||||
2018-7-22 14:14:38,28
|
||||
2018-7-22 14:15:38,28
|
||||
2018-7-22 14:16:38,28
|
||||
2018-7-22 14:17:38,28
|
||||
2018-7-22 14:18:38,28
|
||||
2018-7-22 14:19:38,28
|
||||
2018-7-22 14:20:38,28
|
||||
2018-7-22 14:21:38,28
|
||||
2018-7-22 14:22:38,28
|
||||
2018-7-22 14:23:38,28
|
||||
2018-7-22 14:24:38,28
|
||||
2018-7-22 14:25:38,28
|
||||
2018-7-22 14:26:38,28
|
||||
2018-7-22 14:27:38,28
|
||||
2018-7-22 14:28:38,28
|
||||
2018-7-22 14:29:38,28
|
||||
2018-7-22 14:30:38,28
|
||||
2018-7-22 14:31:38,28
|
||||
2018-7-22 14:32:38,28
|
||||
2018-7-22 14:33:38,28
|
||||
2018-7-22 14:34:38,28
|
||||
2018-7-22 14:35:38,28
|
||||
2018-7-22 14:36:38,28
|
||||
2018-7-22 14:37:38,28
|
||||
2018-7-22 14:38:38,28
|
||||
2018-7-22 14:39:38,28
|
||||
2018-7-22 14:40:38,28
|
||||
2018-7-22 14:41:38,28
|
||||
2018-7-22 14:42:38,28
|
||||
2018-7-22 14:43:38,28
|
||||
2018-7-22 14:44:38,28
|
||||
2018-7-22 14:45:38,28
|
||||
2018-7-22 14:46:38,28
|
||||
2018-7-22 14:47:38,28
|
||||
2018-7-22 14:48:38,28
|
||||
2018-7-22 14:49:38,28
|
||||
2018-7-22 14:50:38,28
|
||||
2018-7-22 14:51:38,28
|
||||
2018-7-22 14:52:38,28
|
||||
2018-7-22 14:53:38,28
|
||||
2018-7-22 14:54:38,28
|
||||
2018-7-22 14:55:38,28
|
||||
2018-7-22 14:56:38,28
|
||||
2018-7-22 14:57:38,28
|
||||
2018-7-22 14:58:38,28
|
||||
2018-7-22 14:59:38,28
|
||||
2018-7-22 15:00:38,28
|
||||
2018-7-22 15:01:38,28
|
||||
2018-7-22 15:02:38,28
|
||||
2018-7-22 15:03:38,28
|
||||
2018-7-22 15:04:38,28
|
||||
2018-7-22 15:05:38,28
|
||||
2018-7-22 15:06:38,28
|
||||
2018-7-22 15:07:38,28
|
||||
2018-7-22 15:08:38,28
|
||||
2018-7-22 15:09:38,28
|
||||
2018-7-22 15:10:38,28
|
||||
2018-7-22 15:11:38,28
|
||||
2018-7-22 15:12:38,28
|
||||
2018-7-22 15:13:38,28
|
||||
2018-7-22 15:14:38,28
|
||||
2018-7-22 15:15:38,28
|
||||
2018-7-22 15:16:38,28
|
||||
2018-7-22 15:17:38,28
|
||||
2018-7-22 15:18:38,28
|
||||
2018-7-22 15:19:38,28
|
||||
2018-7-22 15:20:38,28
|
||||
2018-7-22 15:21:38,28
|
||||
2018-7-22 15:22:38,28
|
||||
2018-7-22 15:23:38,28
|
||||
2018-7-22 15:24:38,28
|
||||
2018-7-22 15:25:38,28
|
||||
2018-7-22 15:26:38,28
|
||||
2018-7-22 15:27:38,28
|
||||
2018-7-22 15:28:38,28
|
||||
2018-7-22 15:29:38,28
|
||||
2018-7-22 15:30:38,28
|
||||
2018-7-22 15:31:38,28
|
||||
2018-7-22 15:32:38,28
|
||||
2018-7-22 15:33:38,28
|
||||
2018-7-22 15:34:38,28
|
||||
2018-7-22 15:35:38,28
|
||||
2018-7-22 15:36:38,28
|
||||
2018-7-22 15:37:38,28
|
||||
2018-7-22 15:38:38,28
|
||||
2018-7-22 15:39:38,28
|
||||
2018-7-22 15:40:38,28
|
||||
2018-7-22 15:41:38,28
|
||||
2018-7-22 15:42:38,28
|
||||
2018-7-22 15:43:38,28
|
||||
2018-7-22 15:44:38,28
|
||||
2018-7-22 15:45:38,28
|
||||
2018-7-22 15:46:38,28
|
||||
2018-7-22 15:47:38,28
|
||||
2018-7-22 15:48:38,28
|
||||
2018-7-22 15:49:38,28
|
||||
2018-7-22 15:50:38,28
|
||||
2018-7-22 15:51:38,28
|
||||
2018-7-22 15:52:38,28
|
||||
2018-7-22 15:53:38,28
|
||||
2018-7-22 15:54:38,28
|
||||
2018-7-22 15:55:38,28
|
||||
2018-7-22 15:56:38,28
|
||||
2018-7-22 15:57:38,28
|
||||
2018-7-22 15:58:38,28
|
||||
2018-7-22 15:59:38,28
|
||||
2018-7-22 16:00:38,28
|
||||
2018-7-22 16:01:38,28
|
||||
2018-7-22 16:02:38,28
|
||||
2018-7-22 16:03:38,28
|
||||
2018-7-22 16:04:38,28
|
||||
2018-7-22 16:05:38,28
|
||||
2018-7-22 16:06:38,28
|
||||
2018-7-22 16:07:38,28
|
||||
2018-7-22 16:08:38,28
|
||||
2018-7-22 16:09:38,28
|
||||
2018-7-22 16:10:38,28
|
||||
2018-7-22 16:11:38,28
|
||||
2018-7-22 16:12:38,28
|
||||
2018-7-22 16:13:38,28
|
||||
2018-7-22 16:14:38,28
|
||||
2018-7-22 16:15:38,28
|
||||
2018-7-22 16:16:38,28
|
||||
2018-7-22 16:17:38,28
|
||||
2018-7-22 16:18:38,28
|
||||
2018-7-22 16:19:38,28
|
||||
2018-7-22 16:20:38,28
|
||||
2018-7-22 16:21:38,28
|
||||
2018-7-22 16:22:38,28
|
||||
2018-7-22 16:23:38,28
|
||||
2018-7-22 16:24:38,28
|
||||
2018-7-22 16:25:38,28
|
||||
2018-7-22 16:26:38,28
|
||||
2018-7-22 16:27:38,28
|
||||
2018-7-22 16:28:38,28
|
||||
2018-7-22 16:29:38,28
|
||||
2018-7-22 16:30:38,28
|
||||
2018-7-22 16:31:38,28
|
||||
2018-7-22 16:32:38,28
|
||||
2018-7-22 16:33:38,28
|
||||
2018-7-22 16:34:38,28
|
||||
2018-7-22 16:35:38,28
|
||||
2018-7-22 16:36:38,28
|
||||
2018-7-22 16:37:38,28
|
||||
2018-7-22 16:38:38,28
|
||||
2018-7-22 16:39:38,28
|
||||
2018-7-22 16:40:38,28
|
||||
2018-7-22 16:41:38,28
|
||||
2018-7-22 16:42:38,28
|
||||
2018-7-22 16:43:38,28
|
||||
2018-7-22 16:44:38,28
|
||||
2018-7-22 16:45:39,28
|
||||
2018-7-22 16:46:39,28
|
||||
2018-7-22 16:47:39,28
|
||||
2018-7-22 16:48:39,28
|
||||
2018-7-22 16:49:39,28
|
||||
2018-7-22 16:50:39,28
|
||||
2018-7-22 16:51:39,28
|
||||
2018-7-22 16:52:39,28
|
||||
2018-7-22 16:53:39,28
|
||||
2018-7-22 16:54:39,28
|
||||
2018-7-22 16:55:39,28
|
||||
2018-7-22 16:56:39,28
|
||||
2018-7-22 16:57:39,28
|
||||
2018-7-22 16:58:39,28
|
||||
2018-7-22 16:59:39,28
|
||||
2018-7-22 17:00:39,28
|
||||
2018-7-22 17:01:39,28
|
||||
2018-7-22 17:02:39,28
|
||||
2018-7-22 17:03:39,28
|
||||
2018-7-22 17:04:39,28
|
||||
2018-7-22 17:05:39,28
|
||||
2018-7-22 17:06:39,28
|
||||
2018-7-22 17:07:39,28
|
||||
2018-7-22 17:08:39,28
|
||||
2018-7-22 17:09:39,28
|
||||
2018-7-22 17:10:39,28
|
||||
2018-7-22 17:11:39,28
|
||||
2018-7-22 17:14:03,29
|
||||
2018-7-22 17:15:03,30
|
||||
2018-7-22 17:16:03,30
|
||||
2018-7-22 17:17:03,30
|
||||
2018-7-22 17:18:03,30
|
||||
2018-7-22 17:19:03,30
|
||||
2018-7-22 17:20:03,30
|
||||
2018-7-22 17:21:03,30
|
||||
2018-7-22 17:22:03,30
|
||||
2018-7-22 17:23:03,30
|
||||
2018-7-22 17:24:03,30
|
||||
2018-7-22 17:25:03,30
|
||||
2018-7-22 17:26:03,30
|
||||
2018-7-22 17:27:03,30
|
||||
2018-7-22 17:28:03,30
|
||||
2018-7-22 17:29:03,30
|
||||
2018-7-22 17:30:03,30
|
||||
2018-7-22 17:31:03,30
|
||||
2018-7-22 17:32:03,30
|
||||
2018-7-22 17:33:03,30
|
||||
2018-7-22 17:34:03,30
|
||||
2018-7-22 17:35:03,30
|
||||
2018-7-22 17:36:03,30
|
||||
2018-7-22 17:37:03,30
|
||||
2018-7-22 17:38:03,30
|
||||
2018-7-22 17:39:03,30
|
||||
2018-7-22 17:40:03,30
|
||||
2018-7-22 17:41:03,30
|
||||
2018-7-22 17:42:03,30
|
||||
2018-7-22 17:43:03,30
|
||||
2018-7-22 17:44:03,30
|
||||
2018-7-22 17:45:03,30
|
||||
2018-7-22 17:46:03,30
|
||||
2018-7-22 17:47:03,30
|
||||
2018-7-22 17:48:03,30
|
||||
2018-7-22 17:49:03,30
|
||||
2018-7-22 17:50:03,30
|
||||
2018-7-22 17:51:03,30
|
||||
2018-7-22 17:52:03,30
|
||||
2018-7-22 17:53:03,30
|
||||
2018-7-22 17:54:03,30
|
||||
2018-7-22 17:55:03,30
|
||||
2018-7-22 17:56:03,30
|
||||
2018-7-22 17:57:03,30
|
||||
2018-7-22 17:58:03,30
|
||||
2018-7-22 17:59:03,30
|
||||
2018-7-22 18:00:03,30
|
||||
2018-7-22 18:01:03,30
|
||||
2018-7-22 18:02:03,30
|
||||
2018-7-22 18:03:03,30
|
||||
2018-7-22 18:04:03,30
|
||||
|
@@ -1,6 +1,6 @@
|
||||
console.log('Connecting to server')
|
||||
|
||||
var socket = io.connect('benkyd.duckdns.org:8081');
|
||||
var socket = io.connect('benkyd.duckdns.org:7001');
|
||||
let temp = [];
|
||||
|
||||
socket.on('connect', function(data) {
|
||||
@@ -13,7 +13,8 @@ socket.on('handshake', function(data) {
|
||||
|
||||
socket.on('temp', function(data) {
|
||||
console.log(data);
|
||||
addPoint(data);
|
||||
if (data[0] * 2 != data[1]) socket.emmit('another');
|
||||
addPoint(data[0]);
|
||||
});
|
||||
|
||||
socket.on('lasthour', function(data) {
|
||||
|
||||
@@ -8,6 +8,7 @@ let io = require('socket.io')(server);
|
||||
/* COMMUNICATION WITH ARDUINO AND CLENSING OF DATA */
|
||||
|
||||
let lastHour = []
|
||||
let history = [];
|
||||
let temperature;
|
||||
const parser = new parsers.Readline({
|
||||
delimiter: '\r\n'
|
||||
@@ -40,12 +41,12 @@ app.use('/', express.static(__dirname + '/client'));
|
||||
app.get('/', function(req, res) {
|
||||
res.sendFile(__dirname + '/client/index.html');
|
||||
});
|
||||
app.listen(8080);
|
||||
console.log('Server listening on 80')
|
||||
app.listen(7000);
|
||||
console.log('Server listening on 8081')
|
||||
|
||||
/* WEBSOCKETS */
|
||||
|
||||
server.listen(8081);
|
||||
server.listen(7001);
|
||||
|
||||
io.on('connection', (socket) => {
|
||||
let ip = socket.request.connection.remoteAddress;
|
||||
@@ -61,12 +62,18 @@ io.on('connection', (socket) => {
|
||||
socket.emit('lasthour', lastHour);
|
||||
|
||||
setInterval(() => {
|
||||
socket.emit('temp', temperature);
|
||||
socket.emit('temp', [temperature, temperature * 2]);
|
||||
}, 60000);
|
||||
});
|
||||
|
||||
socket.on('another', function(data) {
|
||||
socket.emit('temp', [temperature, temperature * 2]);
|
||||
});
|
||||
});
|
||||
|
||||
setInterval(() => {
|
||||
history.push(temperature);
|
||||
lastHour.push(temperature);
|
||||
if (lastHour.length > 60) lastHour.splice(0,1);
|
||||
fs.appendFileSync('client/history.csv', `${new Date().toLocaleString()},${temperature}\n`)
|
||||
}, 60000)
|
||||
|
||||
Reference in New Issue
Block a user