Nathan
Rookie
Joined: Fri Dec 24, 2010 1:16 am Posts: 11
|
 Does anyone know how to connect the MMX to the NXT?
I'm trying to use the Mindsensors's Motor Multiplexer, but I'm not sure how to connect it to the NXT?
So far, I have connected the MMX (port NXT) to the NXT (port S1), connected the green thing on it to a 9 volt battery (can I use this or do I have to use a 6-AA Battery Holder with NXT Mounts?), port M1 to a lego Interactive Servo Motor , and port M2 to a converter cable to a PF extension wire to a LEGO® Power Functions M-Motor.
This is the code I am using, but it doesn't seem to work?
/////////////////////////////////////////////////////////////////////////////////////////////////// // Simple testprogram to show the functionality of the Mindsensors NXTMMX interface in RobotC // The interface/driver is based on the NXC interface written by Deepak Patil for easy migration // // Written by Rudolf Lapie // 26 APRIL 2010 ///////////////////////////////////////////////////////////////////////////////////////////////////
// The driver routines for the Mindsensors Multiplxer #include "NXTMMX-lib.h"
// MAIN TASK : endless loop displaying the values of the PowerMeter task main () { eraseDisplay() ; nxtDisplayCenteredBigTextLine (2, "1 NXT"); nxtDisplayCenteredBigTextLine (4, "5 MOTORS") ; wait10Msec(400) ;
// Configure port S1 to be a low speed I2C sensor. SetSensorType(S1, sensorLowSpeed);
// Initialize the NXT MMX MMX_Init(S1, MMX_ADDRESS, 0) ;
motor[motorA] = MMX_Speed_Full ; eraseDisplay() ; nxtDisplayCenteredBigTextLine (2, "MOTOR"); nxtDisplayCenteredBigTextLine (4, "A") ; wait10Msec(400) ;
motor[motorB] = MMX_Speed_Full ; eraseDisplay() ; nxtDisplayCenteredBigTextLine (2, "MOTOR"); nxtDisplayCenteredBigTextLine (4, "AB") ; wait10Msec(400) ;
motor[motorC] = MMX_Speed_Full ; eraseDisplay() ; nxtDisplayCenteredBigTextLine (2, "MOTOR"); nxtDisplayCenteredBigTextLine (4, "ABC") ; wait10Msec(400) ;
MMX_Run_Unlimited( S1, MMX_ADDRESS, MMX_Motor_1, MMX_Direction_Forward, MMX_Speed_Full) ; eraseDisplay() ; nxtDisplayCenteredBigTextLine (2, "MOTOR"); nxtDisplayCenteredBigTextLine (4, "ABC1") ; wait10Msec(400) ;
MMX_Run_Unlimited( S1, MMX_ADDRESS, MMX_Motor_2, MMX_Direction_Forward, MMX_Speed_Full) ; eraseDisplay() ; nxtDisplayCenteredBigTextLine (2, "MOTOR"); nxtDisplayCenteredBigTextLine (4, "ABC12") ; wait10Msec(400) ;
MMX_Stop( S1, MMX_ADDRESS, MMX_Motor_2, MMX_Next_Action_Brake ); eraseDisplay() ; nxtDisplayCenteredBigTextLine (2, "MOTOR"); nxtDisplayCenteredBigTextLine (4, "ABC1") ; wait10Msec(400) ;
MMX_Stop( S1, MMX_ADDRESS, MMX_Motor_1, MMX_Next_Action_Brake ); eraseDisplay() ; nxtDisplayCenteredBigTextLine (2, "MOTOR"); nxtDisplayCenteredBigTextLine (4, "ABC") ; wait10Msec(400) ;
motor[motorC] = 0 ; eraseDisplay() ; nxtDisplayCenteredBigTextLine (2, "MOTOR"); nxtDisplayCenteredBigTextLine (4, "AB") ; wait10Msec(400) ;
motor[motorB] = 0 ; eraseDisplay() ; nxtDisplayCenteredBigTextLine (2, "MOTOR"); nxtDisplayCenteredBigTextLine (4, "A") ; wait10Msec(400) ;
motor[motorA] = 0 ; eraseDisplay() ; nxtDisplayCenteredBigTextLine (1, "NXT>ABC") ; nxtDisplayCenteredBigTextLine (3, "MMX>12") ; nxtDisplayCenteredTextLine (5, "by MindSensors") ;
wait10Msec(400) ;
wait10Msec(2000) ;
}
/////////////////////////////////////////////////////////////////////////////////////////////////// // THAT's ALL, FOLKS ! ///////////////////////////////////////////////////////////////////////////////////////////////////
Does anyone have a picture on how to do all the connections, if a 9 volt battery will suffice, and what code i should use (I downloaded NXTMMX-lib.h and there are no errors when compiling)?
|