Hello everyone,
I've been playong with arduino a few times and now i want to do my first 'project'
I want to build a bbq thermometer.
I followed the guide here : https://www.safaribooksonline.com/blog/2013/07/25/an-arduino-powered-bbq-thermometer/#comment-157485
The code isn't clear and is divised in 3 section and i'm not sure exactly what goes where.
Here is my code :
var j5 = require("johnny-five");
var board = new j5.Board();
var LEDPIN = 13;
var THMPIN = "A0";
board.on("ready", function(){
var led = new j5.Led(LEDPIN);
var thm = new j5.Sensor({ pin: THMPIN, freq: 500 });
var alertTemperatureF = 80;
var currentTemp;
thm.on("change", function(err, thmVoltage){
currentTemp = convertVoltToTemp(thmVoltage);
if (currentTemp.tempF >= alertTemperatureF) {
led.on();
} else {
led.off();
}
console.log("Current TempF: ", currentTemp.tempF);
});
});
// do stuff w/ the temperature, here
function convertVoltToTemp(volt){
var tempK, tempC, tempF;
// get the Kelvin temperature
tempK = Math.log(((10240000/volt) - 10000));
tempK = 1 / (0.001129148 + (0.000234125 * tempK) + (0.0000000876741 *
tempK * tempK * tempK));
// convert to Celsius and round to 1 decimal place
tempC = tempK - 273.15;
tempC = Math.round(tempC*10)/10;
// get the Fahrenheit temperature, rounded
tempF = (tempC * 1.8) + 32;
tempF = Math.round(tempF*10)/10;
// return all three temperature scales
return {
tempK: tempK,
tempC: tempC,
tempF: tempF
};
}
});
});
here is the error i get when trying to run the code :
C:\Users\Garie\Desktop\Code arduino>node test.js
C:\Users\Garie\Desktop\Code arduino\test.js:17
if (currentTemp.tempF >= alertTemperatureF) {;
^
SyntaxError: Unexpected token ;
at Object.exports.runInThisContext (vm.js:76:16)
at Module._compile (module.js:542:28)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.runMain (module.js:604:10)
at run (bootstrap_node.js:394:7)
at startup (bootstrap_node.js:149:9)
at bootstrap_node.js:509:3
C:\Users\Garie\Desktop\Code arduino>
i'm using an arduino uno
Someone could help please?
Thank you