ROBOTC.net forums
http://www.robotc.net/forums/

IR Drivers Xander
http://www.robotc.net/forums/viewtopic.php?f=41&t=8043
Page 1 of 1

Author:  inandi2015 [ Mon Feb 24, 2014 10:11 pm ]
Post subject:  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?

Author:  mightor [ Tue Feb 25, 2014 4:16 am ]
Post subject:  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);
  }
}

Page 1 of 1 All times are UTC - 5 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/