|
Page 1 of 1
|
[ 8 posts ] |
|
Using a Colour Sensor with a motor multiplexer (NXTMMX)?
| Author |
Message |
|
karl101
Rookie
Joined: Mon Aug 20, 2007 4:01 am Posts: 28
|
 Using a Colour Sensor with a motor multiplexer (NXTMMX)?
Hello, How do I use a LEGO Colour Sensor from the NXT v2.0 box, with an Mindsensors Multiplexer for NXT Motors (NXTMMX-v2)? I am using RobotC v3.04 and the latest Xander's ROBOTC Drivers v2.4 (the mindsensors file gave an error message). The NXTMMX is plugged into S4 on the NXT, and I have a motor on M1 and a LEGO Colour Sensor on the sensor port. With the Colour Sensor plugged in, it does not work, but with it removed, the motor turns as expected. Can anyone help? Thanks Karl. The code below is mostly from Xander's example test file.  |  |  |  | Code: #pragma config(Sensor, S4, MSMMUX, sensorI2CCustom) //*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//
#include "drivers/MSMMUX-driver.h" #pragma platform(NXT)
task main() {
MSMMUXinit(); MSMotorStop(mmotor_S4_1); MSMMotorEncoderResetAll(MSMMUX); MSMMUXsetPID(MSMMUX, 0x1B58, 0x0000, 0x927C, 0x3A98, 0x012c, 0x1D4C, 0x10, 0x80); MSMMotorEncoderReset(mmotor_S4_1); MSMMotorSetBrake(mmotor_S4_1); MSMMotorSetEncoderTarget(mmotor_S4_1, 150); MSMMotor(mmotor_S4_1, 50); PlaySound(soundBeepBeep); wait1Msec(500);
}
|  |  |  |  |
|
| Thu Dec 29, 2011 5:30 pm |
|
 |
|
mightor
Moderator
Joined: Wed Mar 05, 2008 8:14 am Posts: 2863 Location: Rotterdam, The Netherlands
|
 Re: Using a Colour Sensor with a motor multiplexer (NXTMMX)?
I don't think it's a supported configuration, at least it's not something I've ever tested. My guess is the colour sensor interferes with the I2C bus. It is a very unusual sensor. It's analogue but not the same way the regular analogue ones are, like the touch or sound sensor. It uses the dig0 and dig1 pins (used for SCL and SDA for I2C) to go through a series of calibration commands. No publicly available information on how this sensor exists. You could ask Mindsensors to see if this is something they support, you can find their support email address on their website: http://www.mindsensors.com/Do you not have another digital sensor you could hook up to that port? - Xander
_________________| Some people, when confronted with a problem, think, "I know, I'll use threads," | and then two they hav erpoblesms. (@nedbat)| My Blog: I'd Rather Be Building Robots| ROBOTC 3rd Party Driver Suite: [ Project Page]
|
| Thu Dec 29, 2011 5:38 pm |
|
 |
|
karl101
Rookie
Joined: Mon Aug 20, 2007 4:01 am Posts: 28
|
 Re: Using a Colour Sensor with a motor multiplexer (NXTMMX)?
Hello Xander Thanks for the quick reply, I shall email mindsensors and ask. I do have a Hi Technic Colour Sensor, I don't think they're as good. But it does appear to work. Karl.  |  |  |  | Code: #pragma config(Sensor, S4, MSMMUX, sensorI2CCustom)
#include "drivers/MSMMUX-driver.h" #include "drivers/HTCS-driver.h" #pragma platform(NXT) #define HTCS S4
task main() { int red = 0; int green = 0; int blue = 0; int _color = 0; string _tmp; int encA = 0; MSMMUXinit(); MSMotorStop(mmotor_S4_1); MSMMotorEncoderResetAll(MSMMUX); MSMMUXsetPID(MSMMUX, 0x1B58, 0x0000, 0x927C, 0x3A98, 0x012c, 0x1D4C, 0x10, 0x80); MSMMotorEncoderReset(mmotor_S4_1); MSMMotorSetBrake(mmotor_S4_1);
MSMMotorSetEncoderTarget(mmotor_S4_1, 150); MSMMotor(mmotor_S4_1, 50);
PlaySound(soundBeepBeep); wait1Msec(500); while (true) { _color = HTCSreadColor(HTCS); encA = MSMMotorEncoder(mmotor_S4_1);
nxtDisplayCenteredTextLine(0, "C: %d, E: %d", _color, encA); nxtDisplayCenteredBigTextLine(1, "R G B");
nxtEraseRect(0,10, 99, 41); nxtFillRect( 0, 10, 30, 10 + (red+1)/8); nxtFillRect(35, 10, 65, 10 + (green+1)/8); nxtFillRect(70, 10, 99, 10 + (blue+1)/8); StringFormat(_tmp, " %3d %3d", red, green); nxtDisplayTextLine(7, "%s %3d", _tmp, blue);
wait1Msec(100); } }
|  |  |  |  |
|
| Thu Dec 29, 2011 6:15 pm |
|
 |
|
mightor
Moderator
Joined: Wed Mar 05, 2008 8:14 am Posts: 2863 Location: Rotterdam, The Netherlands
|
 Re: Using a Colour Sensor with a motor multiplexer (NXTMMX)?
Is it a new or old HiTechnic colour sensor? The V2 ones are fantastic, a LOT better than the LEGO one.
- Xander
_________________| Some people, when confronted with a problem, think, "I know, I'll use threads," | and then two they hav erpoblesms. (@nedbat)| My Blog: I'd Rather Be Building Robots| ROBOTC 3rd Party Driver Suite: [ Project Page]
|
| Thu Dec 29, 2011 6:22 pm |
|
 |
|
NeXT-Generation
Senior Roboticist
Joined: Wed Sep 28, 2011 10:13 pm Posts: 509 Location: Totally not spying on Hassenplug to see what he has for the Brickworld Chicago 2013 sumo contest.
|
 Re: Using a Colour Sensor with a motor multiplexer (NXTMMX)?
There is a comparison of the LEGO and HT Color sensors here. I don't think you'll be able to use the LEGO one on it anyway. Here's why: But, not having the Multiplexer or the HT sensor, I can't be sure.
_________________A.K.A. inxt-generation Self-proclaimed genius, and future world dominator. My Brickshelf Folder"Don't they teach recreational mathematics anymore?" - The Tenth Doctor Bow down to Nikola Tesla, King of the Geek Gods.
|
| Thu Dec 29, 2011 6:24 pm |
|
 |
|
karl101
Rookie
Joined: Mon Aug 20, 2007 4:01 am Posts: 28
|
 Re: Using a Colour Sensor with a motor multiplexer (NXTMMX)?
Hello,
My hi-technic sensor will be the old one. Obviously, I shall have to upgrade.
Thanks.
Karl
|
| Thu Dec 29, 2011 8:22 pm |
|
 |
|
mightor
Moderator
Joined: Wed Mar 05, 2008 8:14 am Posts: 2863 Location: Rotterdam, The Netherlands
|
 Re: Using a Colour Sensor with a motor multiplexer (NXTMMX)?
Well, not necessarily. Does it have two little round lenses on the front or one round and one flat? If it's two round ones, it's a V1 and if one round, one flat it's a V2.
- Xander
_________________| Some people, when confronted with a problem, think, "I know, I'll use threads," | and then two they hav erpoblesms. (@nedbat)| My Blog: I'd Rather Be Building Robots| ROBOTC 3rd Party Driver Suite: [ Project Page]
|
| Fri Dec 30, 2011 2:34 am |
|
 |
|
karl101
Rookie
Joined: Mon Aug 20, 2007 4:01 am Posts: 28
|
 Re: Using a Colour Sensor with a motor multiplexer (NXTMMX)?
Both the lenses are rounded. I've had the sensor for quite some time.
Karl.
|
| Fri Dec 30, 2011 5:28 am |
|
|
|
Page 1 of 1
|
[ 8 posts ] |
|
Who is online |
Users browsing this forum: No registered users and 6 guests |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot post attachments in this forum
|
|