footballbot
A module to control the football bot for NodeBots of London's International NodeBots Day celebrations.
You should install the following sketch on the Dagu mini driver board:
const byte MOTOR_SPEED = 0xF0;
const byte MOTOR_DIRECTION = 0xF1;
const byte DIGITAL_WRITE = 0xF2;
void setup()
{
Serial.begin(9600);
pinMode(7, OUTPUT);
pinMode(8, OUTPUT);
pinMode(9, OUTPUT);
pinMode(10, OUTPUT);
pinMode(13, OUTPUT);
}
void loop()
{
if(Serial.available() == 3) {
digitalWrite(13, HIGH);
byte command = Serial.read();
byte pin = Serial.read();
byte value = Serial.read();
if(command == MOTOR_SPEED) {
analogWrite(pin, value);
} else if(command == MOTOR_DIRECTION || command == DIGITAL_WRITE) {
digitalWrite(pin, value);
}
}
}
Then execute a node script that looks something like:
var FootballBot = var footballBot = '/dev/tty.linvor-DevB'footballBot
Constructor options
The board constructor supports an options argument. The default values for this are:
var footballBot = new FootballBot('/dev/tty.linvor-DevB', {
// create a repl and expose it as footballBot.repl
repl: true
})
The FootballBot.Motor
class supports a similar API to the Johnny-Five equivalent.