// --------------------------------------------------------------------------
// -- uv-sensor.js
// --------------------------------------------------------------------------
var five = require("johnny-five");
var board = new five.Board();
let uvReading = 0;
let uvVoltage = 0;
board.on("ready", function() {
let uvSensor = new five.Sensor({
pin: "A0",
freq: 500
});
uvSensor.on("data", function () {
uvReading = this.value;
uvVoltage = this.value/1024*5.0;
console.log("sensor value: " + uvReading, "; sensor voltage: " + uvVoltage + "V");
})
});