Better Vernie example

This commit is contained in:
Nathan Kunicki 2018-06-22 15:56:48 +01:00
parent 138cca1b34
commit dce0fccc6d

View File

@ -7,11 +7,11 @@ console.log("Looking for Vernie (Please turn the Hub on now)...");
lpf2.on("discover", async (vernie) => { // Wait to discover Vernie lpf2.on("discover", async (vernie) => { // Wait to discover Vernie
lpf2.stop(); // Stop scanning for Vernie (We've already found him!) lpf2.stop(); // Stop scanning for Vernie (We've just found him!)
await vernie.connect(); // Connect to Vernie await vernie.connect(); // Connect to Vernie
console.log("Connected to Vernie!"); console.log("Connected to Vernie!");
await vernie.wait(3000); // Wait for 2 seconds before starting await vernie.wait(3000); // Wait for 3 seconds before starting
console.log("We're going on an adventure!"); console.log("We're going on an adventure!");
await vernie.setMotorSpeed("AB", 50, 2000); // Move forward for 2 seconds await vernie.setMotorSpeed("AB", 50, 2000); // Move forward for 2 seconds