TouchMux Issue

This is where you talk about the NXJ software itself, installation issues, and programming talk.

Moderators: 99jonathan, roger, imaqine

TouchMux Issue

Postby icemadsen » Sat Feb 04, 2012 12:13 am

Hi!

I've been working on a model, which uses a Mindsensors TouchMUX. However it seems to behave a bit strange, which can be detected in the following test:

Code: Select all
TouchMUX Mux = new TouchMUX(SensorPort.S3);
boolean T1_Pressed, T2_Pressed, T3_Pressed;
while(!Button.ESCAPE.isPressed()){
   T1_Pressed = Mux.T1.isPressed();
   T2_Pressed = Mux.T2.isPressed();
   T3_Pressed = Mux.T3.isPressed();
   if(T1_Pressed){
      Sound.beep();
   }
   LCD.drawString("T1: "+T1_Pressed+" ", 0, 1);
   LCD.drawString("T2: "+T2_Pressed+" ", 0, 2);
   LCD.drawString("T3: "+T3_Pressed+" ", 0, 3);
}


If you rapidly press T2 and T3 buttons, as a stress-test, T1 is registered as Pressed and the NXT beeps, even though you only pressed the two other buttons.

I have tried with two different TouchMux's and the problem occurs in both.

I would like to know if this is fixable, or if it is normal behaviour for the TouchMux?

Also, I can see in the code for TouchMux, that there is a lot of limit-values and I was wondering if these values can be specific/varying for each TouchMux sensor? In that case, how can I easily make a calibration program?

Thank you!

- Kenneth
User avatar
icemadsen
Novice
 
Posts: 31
Joined: Tue Dec 08, 2009 11:41 am

Re: TouchMux Issue

Postby gloomyandy » Sat Feb 04, 2012 4:17 pm

Hi,
The touch mux just returns a singlr A/D sensor reading and then works out which sensors are pressed based upon the value read. I suspect that what you are seeing is the effect of contact resistance in the switches or perhaps contact bounce. Either way if you want to see what the actual readings are then simply read the raw A/D reading from the sensor port rather than using the driver. That way you should be able to work out what is going on....

Andy
User avatar
gloomyandy
leJOS Team Member
 
Posts: 4010
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK


Return to NXJ Software

Who is online

Users browsing this forum: No registered users and 1 guest

more stuff