Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
board.on('ready', function() {
console.log('Arduino board ready'.debug);
// We're assuming a standard 2x16 LCD display that we're going to use in
// the usual 4-bit mode.
lcd = new five.LCD({
// RS EN DB4 DB5 DB6 DB7
pins: [5, 6, 7, 8, 9, 10]
});
lcd.on('ready', function() {
lcd.clear().print('Welcome Mix-IT');
});
green = new five.Led({ pin: 11 }).off();
yellow = new five.Led({ pin: 12 }).off();
red = new five.Led({ pin: 13 }).off();
bindToEngine();
});
var connect_the_dots = function()
{
console.log("Device Ready to connect its dots");
// Initialize LCD
var lcd = new five.LCD({
controller: "JHD1313M1"
});
lcd.bgColor(0xFF, 0xFF, 0xFF).cursor(0,0).print('ConnectTheDots');
lcd.bgColor(0xFF, 0xFF, 0xFF).cursor(1,0).print('Azure IoT');
// Initialize temperature sensor
var data_temperature = {"measurename":"Temperature", "unitofmeasure":"C", "value":0};
var data_humidity = {"measurename":"Humidity", "unitofmeasure":"%", "value":0};
var temperature_humidity = new TH02(6);
setInterval(function(){
data_temperature.value = temperature_humidity.getCelsiusTemp();
data_humidity.value = temperature_humidity.getHumidity();
// Jut for the fun of it, let's color the LCD background based on temperature
var r = linear(0x00, 0xFF, data_temperature.value, 40);
address = params[1],
string = params[2];
} else if (params.length == 2){
address = "0x20";
string = params[1];
}
log("address: " + address);
log("string: " + string);
string = decodeURI(string);
if (!lcds[address]) {
log("creating lcd at address: " + address);
lcds[address] = {
obj: new five.LCD({
controller: "PCF8574", // works for DF lcd
address : 0x20 + (Number(address - "0x20") || 0)
}),
msg: ""
};
}
var lcd = lcds[address].obj;
var msg = lcds[address].msg;
if (msg != string){
lcd.clear();
lcd.blink();
lcds[address].msg = string;
lcd.print(string);
board.on("ready", function() {
// Init the LCD
var lcd = new five.LCD({
// LCD pins RS EN DB4 DB5 DB6 DB7
pins: [ 7, 8, 9, 10, 11, 12 ],
rows: 2, cols: 16
});
// Set up Firebase to reference the cryptocurrency open data set
var myFirebaseRef = new Firebase("https://publicdata-cryptocurrency.firebaseio.com/bitcoin");
lcd.on("ready", function() {
// Listen for changes to the Bitcoin price
myFirebaseRef.child("last").on("value", function(snap) {
// Print the value on the LCD
lcd.cursor(1, 1).clear().print("BTC: " + snap.val());
});
});
});
// the Repl instance's context;
// allows direct command line access
board.repl.inject({
pot: potentiometer
});
var lastKnownVal = 0;
// "data" get the current reading from the potentiometer
potentiometer.on("data", function() {
if(this.value != lastKnownVal) {
lastKnownVal = this.value;
myFirebaseRef.set(this.value);
}
});
var lcd = new five.LCD({
// LCD pin name RS EN DB4 DB5 DB6 DB7
// Arduino pin # 7 8 9 10 11 12
pins: [ 7, 8, 9, 10, 11, 12 ],
rows: 2,
cols: 16
});
lcd.on("ready", function() {
myFirebaseRef.on("value", function(snap) {
lcd.clear().print(snap.val());
lcd.cursor(1, 0);
});
});
});
board.on("ready", function() {
var button = new five.Button(6);
var lcd = new five.LCD({
pins: [12, 11, 5, 4, 3, 2],
});
var crystalBall = new CrystalBall(lcd);
crystalBall.ask();
button.on("press", function() {
crystalBall.reply();
});
});
board.on('ready', () => {
var lcd = new five.LCD({
pins: ['a2', 'a3', 'a4', 'a5', 'a6', 'a7'],
});
lcd.cursor(0, 0).print('Hello');
lcd.cursor(1, 0).print('World');
});
board.on("ready", function() {
var lcd = new five.LCD({
controller: "JHD1313M1"
});
lcd.useChar("heart");
lcd.cursor(0, 0).print("I :heart: Johnny-Five");
});