View unanswered posts | View active topics It is currently Wed Oct 22, 2014 11:33 am






Reply to topic  [ 2 posts ] 
IR Drivers Xander 
Author Message
Rookie

Joined: Tue Jul 17, 2012 8:11 pm
Posts: 20
Post IR Drivers Xander
For Xander's Driver's for IR sensor, is there any way to use it on two IR sensors connected to two separate ports and name them different things. I am only aloud to name the IR sensor HTIRS2 for it to work with the drivers, but I want to name the second IR sensor a different name and still be supported by the drivers. Is there any way to have two IR sensors supported by this driver with one being a different name so they don't conflict with each other?


Mon Feb 24, 2014 10:11 pm
Profile
Moderator
Moderator
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3225
Location: Rotterdam, The Netherlands
Post Re: IR Drivers Xander
You can have up to 16 of them (using a HT SMUX) if you want :) However, to use just two of them, directly connected to the NXT, use something like this:
Code:
#pragma config(Sensor, S1,     HTIRS2_1,       sensorI2CCustom)
#pragma config(Sensor, S2,     HTIRS2_2,       sensorI2CCustom)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

#include "drivers/hitechnic-irseeker-v2.h"

// main task
task main ()
{
  while(true)
  {
    nxtDisplayTextLine(2, "Sensor 1: %d" , HTIRS2readACDir(HTIRS2_1));
    nxtDisplayTextLine(3, "Sensor 2: %d" , HTIRS2readACDir(HTIRS2_2));
    wait1Msec(50);
  }
}

_________________
| 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]


Tue Feb 25, 2014 4:16 am
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 2 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.