I am trying to do this tutorial https://openhomeautomation.net/bluetooth-heart-rate-sensor-arduino
this is the code
var express = require('express');
var app = express();
var port = 3000;
app.set('veiw engine','jade')
app.use(express.static(__dirname + '/public'))
app.get('/', function(req, res){
res.render('simple');
});
var rest = require("arest")(app);
rest.addDevice('serial','COM3', 115200);
app.listen(port);
console.log("Listening on port " + port);
void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
}
In the tutorial, it said to alter this line rest.addDevice('serial','/dev/tty.usbmodem1a12121', 115200); so I changed it to rest.addDevice('serial', 'COM3', 115200);
but I am getting the error code below. Am I writing it wrong or is that the wrong port?
ERROR CODE:
Arduino: 1.8.4 (Windows 10), Board: "Arduino/Genuino Uno"
C:\Users\Wicke\OneDrive\Documents\Arduino\sketch_jan12a\sketch_jan12a.ino:2:23: warning: character constant too long for its type
var express = require('express');
^
C:\Users\Wicke\OneDrive\Documents\Arduino\sketch_jan12a\sketch_jan12a.ino:9:9: warning: character constant too long for its type
app.set('veiw engine','jade')
^
C:\Users\Wicke\OneDrive\Documents\Arduino\sketch_jan12a\sketch_jan12a.ino:9:23: warning: character constant too long for its type
app.set('veiw engine','jade')
^
C:\Users\Wicke\OneDrive\Documents\Arduino\sketch_jan12a\sketch_jan12a.ino:12:36: warning: character constant too long for its type
app.use(express.static(__dirname + '/public'))
^
C:\Users\Wicke\OneDrive\Documents\Arduino\sketch_jan12a\sketch_jan12a.ino:16:14: warning: character constant too long for its type
res.render('simple');
^
C:\Users\Wicke\OneDrive\Documents\Arduino\sketch_jan12a\sketch_jan12a.ino:22:16: warning: character constant too long for its type
rest.addDevice('serial','COM3', 115200);
^
C:\Users\Wicke\OneDrive\Documents\Arduino\sketch_jan12a\sketch_jan12a.ino:22:25: warning: character constant too long for its type
rest.addDevice('serial','COM3', 115200);
^
sketch_jan12a:2: error: 'var' does not name a type
var express = require('express');
^
sketch_jan12a:3: error: 'var' does not name a type
var app = express();
^
sketch_jan12a:6: error: 'var' does not name a type
var port = 3000;
^
sketch_jan12a:9: error: 'app' does not name a type
app.set('veiw engine','jade')
^
sketch_jan12a:17: error: expected unqualified-id before ')' token
});
^
sketch_jan12a:20: error: 'var' does not name a type
var rest = require("arest")(app);
^
sketch_jan12a:22: error: 'rest' does not name a type
rest.addDevice('serial','COM3', 115200);
^
sketch_jan12a:25: error: 'app' does not name a type
app.listen(port);
^
sketch_jan12a:26: error: 'console' does not name a type
console.log("Listening on port " + port);
^
exit status 1
'var' does not name a type
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.