Blog Post

More Motors with PiStorms

More Motors with PiStorms

3381

Introduction

The PiStorms board has four sensor ports and four motor ports.  As shown below.




The NXTMMX has two motor ports, a sensor port, and the NXT port. As shown below.



Connecting a NXTMMX to the 1 out of 4, PiStorms sensor ports gives us full access to the NNXTMMX. This would include the two motor ports and the sensor port. Since there are four sensor ports on the PiStorms we can connect four NXTMMX to each one.

How It Works

First using an NXT cable you must connect the NXT port on the, NXTMMX to any sensor port on the PiStorms.  Now you need a power supply for the NXTMMX. The NXTMMX requires a 9 volt power supply, so a 6AA battery pack should do the trick.  you must call the appropriate functions . If you have already installed the Pistorms software, you can call by using this command at the beginning of your python program.

from PiStorms import PiStorms
from mindsensors_i2c import mindsensors_i2c
from mindsensors import MMX


Now you must right python code to initialize the correct sensor port to read and write i2c.  You can do this by entering the following command:

psm.BAS1.activateCustomSensorI2C()


Now set the function MMX(), to a variable with its i2c address, leaving the parathesis blank will use the default NXTMMX address. IF YOU ARE USING MORE THAN ONE NXTMMX YOU MUST ENSURE THAT ALL NXTMMX'S HAVE DIFFERENT I2C ADDRESS. You can do this by follow the instructions found HERE

mmx1 = MMX()
mmx2 = MMX(0x08) #0x08 is the new i2c address we changed for the second NxtMMX


This allows you to use all of the commands for the MMX in the mindsensors.py API, for example.

mmx1.setSpeed(1, 100) #1 for motor 1, 100 for motor speed
mmx1.setSpeed(2, 100)
mmx2.setSpeed(2, -100)


You can download the example python program used HERE.

Comments (0)

No comments at this moment
Please Login to add your comments

Featured Posts

Learn programming with Blockly visual programming environment for PiStorms

Read more
image-recognition-robot-with-pistorms-and-pi-camera

image-recognition-robot-with-pistorms-and-pi-camera

Want to make a PiStorms robot that uses a PiCamera to recognize icons placed in front of it and reacts...

Read more

Poll

  • What do you use to program your FRC Robot?
    Total: