-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.js
More file actions
27 lines (23 loc) · 678 Bytes
/
index.js
File metadata and controls
27 lines (23 loc) · 678 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
const fs = require('fs');
const readLastLines = require('read-last-lines');
const say = require('say')
function driver(){
// fs.readFile('output.txt', 'utf8', function(err, data) {
// if (err) throw err;
// console.log(data);
// if(data) {
// console.log("hello");
// }
// fs.writeFile('output.txt', '', function(){console.log('done')})
// });
readLastLines.read('output.txt', 2)
.then((lines) => {
console.log(lines);
if(lines === '1\r\n'){
say.speak("Obstacle");
}
});
}
console.log('before setInterval');
say.speak("System started");
setInterval(driver, 1000);