1
I am creating my first application with nodejs and have a question in javascript. In the code below I am reading a sensor and saving in 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;
});
});
Sergio thanks for the help, but in that case I would have to pass the value variable from file A to file B. If you re-turn the value variable in file A and require in file B, it will work?
– Giovane Zanon
@Giovanezanon can explain what the variable is, if it is A that wants to inform B pu if it is B that needs to fetch A?
– Sergio