More Motors with PiStorms
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:
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
You can download the example python program used HERE.