I'm creating my first application with nodejs and I have a question in javascript. In the code below I'm reading a sensor and saving in the variable value every 30 seconds, I wonder if I can use this variable and its value in another js file? How would this be done?
var five = require("johnny-five"),
board, potentiometer;
board = new five.Board();
board.on("ready", function() {
potentiometer = new five.Sensor({
pin: "A2",
freq: 30000
});
board.repl.inject({
pot: potentiometer
});
potentiometer.on("data", function() {
var valor = this.value;
});
});