View unanswered posts | View active topics It is currently Thu Jul 24, 2014 3:01 am






Reply to topic  [ 4 posts ] 
SMUX Programming 
Author Message
Rookie

Joined: Thu May 17, 2012 3:35 pm
Posts: 35
Post SMUX Programming
Hello

How can i use this SMUX? I tested Xandres Third party programms, but I don't know whow to use for a sensor.

When I use the HTTMUX, it's easy:

Code:
#pragma config(Sensor, S4, HTTMUX,   sensorAnalogInactive)
#include "drivers/HTTMUX-driver.h"

task main()
{
 while(true)
     {
 if (HTTMUXisActive(HTTMUX, 2) == 1)
    {
      PlayTone(840, 15);
      int my_number3 = 3;
      wait1Msec(3000);
// and so on..........

}
}


but for the SMUX?

Code:
#pragma config(Sensor, S2, HTSMUX, sensorI2CCustom)
#include "drivers/HTSMUX-driver.h"
task main()
{
while(true)
{
     if(sensorI2CCustom(HTSMUX, 3) == 1))  //touchsensor at 3
     {
     StopAllTasks();

    }
}
}

????

Greetings Frank


Wed Aug 15, 2012 11:51 am
Profile
Moderator
Moderator
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3162
Location: Rotterdam, The Netherlands
Post Re: SMUX Programming
Hi Frank,

Take a look at the countless examples I made. They're all named <sensorname>-SMUX-test<nr>.c. For example the one for the LEGO touch sensor is called LEGOTS-SMUX-test1.c. There are lots of them.

- Xander

_________________
| Professional Conduit of Reasonableness
| (Title bestowed upon on the 8th day of November, 2013)
| My Blog: I'd Rather Be Building Robots
| ROBOTC 3rd Party Driver Suite: [Project Page]


Wed Aug 15, 2012 11:57 am
Profile WWW
Rookie

Joined: Thu May 17, 2012 3:35 pm
Posts: 35
Post Re: SMUX Programming
your great. Thanks

but when I try to use the US Sensor

Code:
   
const tMUXSensor LEGOUS = msensor_S2_2;  // ultraschall

task main()
{
  initializeRobot();

  int dist = 0; //ultraschall front

task main()
{
 while (true)
 {
  nxtDisplayTextLine(0, "Lego US Sensor");
        // Read the current distance detected.
    dist = USreadDist(LEGOUS);

    // display the info from the sensor
    nxtDisplayTextLine(3, "Dist:  %3d cm", dist);
    wait10Msec(50);
}
}


The message: **Error**:Undefined procedure 'USreadDist' will be shown..


Thu Aug 16, 2012 2:15 am
Profile
Rookie

Joined: Thu May 17, 2012 3:35 pm
Posts: 35
Post Re: SMUX Programming
and onother:
**Error**:Variable 'sensorI2CCustom' is subsequently used as a procedure


Thu Aug 16, 2012 2:20 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 4 posts ] 

Who is online

Users browsing this forum: No registered users and 2 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

Search for:
Jump to:  



Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.