Skip to content

blasterbug/Matbotics

Repository files navigation

Matbotics

Matbotics is a Arduino library to control Matrix Robotics System controller.
Matbotics uses Arduino I2C master library to support repeat start, because Wire library (issued with the Arduino IDE) does not.

Features

  • Get battery level, controller status, version, etc.
  • Control all servos
  • Set speed of all motors
  • Set motor target
  • Read motors encoders value
  • Timeout function

Installation (Unix like systems)

Open a terminal and run :

$ cd <UserDirectory>/Arduino/libraries
$ git clone https://github.com/blasterbug/Matbotics.git

Now after (re)starting the Arduino IDE you shloud see Matbotics in Arduino libraries menu.

Exemple

This exemple shows how to control a servo plugged to the port one

// import libraries
#include <I2C.h>
#include <Matbotics.h>

// use the controller
MTController ctlr;

void setup()
{
    // enable servos
    ctlr.enableServos();
    // switchoff timeout
    ctlr.timeout( 0 );
    // set a custom speed for the servo one
    ctlr.servoOneSpeed( 5 );
}

// some variables
int angle = 0;

void loop()
{
    // increase angle and stay in boundaries
    angle = (angle + 10)%250;
    // set the angle to the first servo
    ctlr.servoOneAngle( angle );
    delay( 600 ); 
}

TODO

  • More exemples
  • Optimization?

Connect Lego Mindstorms devices to Arduino boards

NXT clipped off wire

NXT uses RJ12 wires made like this :

  • white : analog
  • black : ground
  • red : ground
  • green : 4.3V
  • yellow : I2C clock line (SCL)
  • blue : I2C data line (SDA)

Connect the red and the black wire to Arduino ground pin, the yellow to a SCL pin and the blue one to a SDA pin. On Arduino boards this pins are clearly identified.