Wilson Mendes
@willmendesneto
Google Developer Expert Web Technologies
1. Access https://goo.gl/PibUcQ
2. Decrease the price until the minimum
3. Enjoy
...
var nodebots = 'NodeGirls + Nodebots = <3';
console.log(nodebots);
...
...
var nodebots = [
'NodeGirls',
'+',
'Nodebots',
'=',
'<3'
];
console.log(nodebots.join(' '));
...
function nodebotsMessage() {
var addThisTextBetweenTheWords = ' ';
var nodebots = [
'NodeGirls',
'+',
'Nodebots',
'=',
'<3'
];
return nodebots.join(addThisTextBetweenTheWords);
}
console.log(nodebotsMessage());
function nodebotsMessage(messageComplement) {
var addThisTextBetweenTheWords = ' ';
var nodebots = [
'NodeGirls',
'+',
'Nodebots',
'='
];
if (messageComplement) {
nodebots.push(messageComplement);
}
return nodebots.join(addThisTextBetweenTheWords);
}
console.log(nodebotsMessage('<3'));
File > Examples > Firmata > StandardFirmata
https://nodejs.org/en/download/
// Blink a LED
var five = require("johnny-five");
var board = new five.Board();
board.on("ready", function() {
// Number of the pin connected on the board
var pinNumbers = [12];
// Starting the LED
var leds = new five.Leds(pinNumbers);
// And here is the magic! \o/
leds.blink();
});
// Blink a LED
var five = require("johnny-five");
var board = new five.Board();
board.on("ready", function() {
var pinButtons = [13];
var buttons = new five.Buttons(pinButtons);
buttons.on("press", function(button) {
console.log("Pressed: ", button.pin);
});
buttons.on("release", function(button) {
console.log("Released: ", button.pin);
});
});
// Make button controls the LED
var five = require('johnny-five');
var board = new five.Board();
board.on('ready', function() {
var leds = new five.Leds([12]);
var buttons = new five.Buttons({
pins: [13],
invert: true
});
buttons.on('press', function(button) {
var index = buttons.indexOf(button);
leds[index].on();
console.log('presssed', leds[index].pin);
});
buttons.on('release', function(button) {
var index = buttons.indexOf(button);
leds.off();
console.log('released');
});
});
// Make button controls the LED and PIEZO
var five = require('johnny-five');
var board = new five.Board();
board.on('ready', function() {
var leds = new five.Leds([12]);
var buttons = new five.Buttons({
pins: [13],
invert: true
});
var piezo = new five.Piezo(11);
buttons.on('press', function(button) {
var index = buttons.indexOf(button);
leds[index].on();
piezo.play({ song: 'C4' });
});
buttons.on('release', function(button) {
var index = buttons.indexOf(button);
leds[index].off();
piezo.off();
});
});
board.on('ready', function() {
leds = new five.Leds([12, 3]);
var buttons = new five.Buttons([13, 2]);
piezo = new five.Piezo(11);
buttons.on('press', function(button) {
var index = buttons.indexOf(button);
leds[index].on();
piezo.play({ song: piezoSongs[index] });
console.log('Pressed: button', button.pin);
});
// Starting the game
startGame();
...
});
...
buttons.on('release', function(button) {
var index = buttons.indexOf(button);
console.log('Released: button', button.pin);
leds.off();
piezo.off();
...
});
...
1. Access https://goo.gl/PibUcQ
2. Decrease the price until the minimum
3. Enjoy
Wilson Mendes
@willmendesneto