On Github sejoker / quickbot-slides
int ledPin = 13; // LED connected to digital pin 13
// The setup() method runs once, when the sketch starts
void setup() {
// initialize the digital pin as an output:
pinMode(ledPin, OUTPUT);
}
// the loop() method runs over and over again,
// as long as the Arduino has power
void loop()
{
digitalWrite(ledPin, HIGH); // set the LED on
delay(1000); // wait for a second
digitalWrite(ledPin, LOW); // set the LED off
delay(1000); // wait for a second
}
var j5 = require("johnny-five");
var myBoard, myLed;
myBoard = new j5.Board();
myBoard.on("ready", function() {
myLed = new j5.Led(13);
myLed.strobe( 1000 );
// make myLED available as "led" in REPL
this.repl.inject({
led: myLed
});
// try "on", "off", "toggle", "strobe", "stop" (stops strobing)
});
Command Set:
========================== ===============================================
$CHECK*\n returns 'Hello from QuickBot'
$PWM?*\n returns wheel speeds in PWM: [50, -50]\n
$PWM=[-100,100]*\n sets the speed of the robot wheel velocities
$ENVAL?*\n returns the encoder ticks ``(tl, tr)`` tuple
$ENVEL?*\n returns the encoder velocities ``(vl, vr)``
tuple
$IRVAL?*\n returns the 5-tuple raw ADC values of the IR
sensors, e.s [80.0, 251.0, 234.1, 12.1, 21.3]\n
$RESET*\n resets encoder position to zero
$END*\n disconnects from socket
========================== ===============================================