Hi,i want use port splitter for NXT digital sensors. I tried connect ultrasonic sensor and compas sensor to the splitter and splitter to the input port S1. I wanted only display the values on NXT brick display. But i dont know how to differentiate sensors on the same port. Cann someone explain to me how to declare both sensors in RobotC? Thanks for the anwer.

Fri Jan 17, 2014 4:34 pm

BurningLights

Professor

Joined: Sat Aug 31, 2013 9:15 amPosts: 256

Re: Port Splitter for NXT Digital Sensors

I believe the best option for you is to use Xander's drivers. In ROBOTC under the File menu, choose the Open Sample Program option. From there, navigate to the "3rd Party Sensor Drivers" folder and open "lego-ultrasound-SMUX-test1.c" That should provide you with the basic framework for how to read an ultrasonic sensor value from a sensor multiplexor.

Ok, I can use drivers for sensor multiplexer also for port splitter, too? Thats the same proces?

Xander's drivers are for the HiTechnic Sensor MUX. What kind of port splitter are you using? If it is not the Hitechnic sensor mux, I am afraid it won't work. Besides, I believe that part may be illegal for FTC if it is not on the "approved list".

Fri Jan 17, 2014 9:15 pm

Ford Prefect

Guru

Joined: Sat Mar 01, 2008 12:52 pmPosts: 1030

Re: Port Splitter for NXT Digital Sensors

to my guess he's using simple splitters, no multiplexers.

Maybe better don't use #pragma config (delete these lines!),switch S1 to I²C mode and then just set sensors manually to the same port.I often did this already for 3 i2C sensors at 1 NXT port (by NXC).

Code:

dist = USreadDist(S1);direct = HTMCreadHeading(S1);

If both devices have different i2c device addresses the sensor reading works automatically correct, for i2c for up to 127 devices at 1 NXT port.Be sure you have a sleep(20_ms) between your readings (i2c bus delay).

Admittedly, unfortunately, Mindsensors often uses the same i2c device address as Lego (0x02), then it won't work of course.So what is your device address for the compass like?

If the i2c device addresses are different and it doesn't work though, try to use your USS in single shot mode.In case they are identical then you will need a sensor multiplexer.

I read a user guide and port splitter should support LEGO Ultrasonic Sensor and HiTechnic Compass Sensor. If i connect only one of them to the NXT Brick throught the port splitter, so everything is working correctly. But both together not. I´m probably using the wrong I2C adressing.

Sat Jan 18, 2014 5:51 am

hanzi23

Rookie

Joined: Fri Jan 03, 2014 4:58 pmPosts: 10

Re: Port Splitter for NXT Digital Sensors

I read user guide again and Magnetic compass for NXT (CMPS-Nx) isn´t the same as HiTechnic Compass sensor. HT Compass isn´t probably supported with port splitter.... But thanks for your help

Sat Jan 18, 2014 6:04 am

Ford Prefect

Guru

Joined: Sat Mar 01, 2008 12:52 pmPosts: 1030

Re: Port Splitter for NXT Digital Sensors

surely, every i2c device is "supported" by the portssplitter, it's just 3x electrical connection plug.Of course you need the correct device driver from Xander's suite.

The compass can be programmed using LEGO Mindstorms NXT Software Compass Block*. If the Compass Block is not available you may also use the standard Ultrasonic Block.

That means that both devices must have the same i2c bus device address, otherwise this wouldn't work (0x02 as I suspected).So compass and USS can't work at the same time at the same NXT port (a quite stupid thing done by the manufactures IMO), but both sensors work with different i2c sensors nevertheless at the portsplitter.

Who is online

Users browsing this forum: No registered users and 2 guests

You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot post attachments in this forum