text: #pragma config(Sensor, S1,     IRSEEK,         sensorI2CCustom)
  #pragma config(Sensor, S2,     ULTRA,          sensorI2CCustom)
  //*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//
  
  #include "drivers/hitechnic-irseeker-v2.h"
  #include "drivers/hitechnic-gyro.h"
  #include "drivers/lego-ultrasound.h"
  
  long ultraSetSingleStartTime = 0;
  bool ultraSettingSingle = false;
  
  task main()
  {
  	//ULTRA variables
  	tByteArray ultraDists;
  	int ultraDistance = 0;
  
  	//IR variables
  	int dcS1, dcS2, dcS3, dcS4, dcS5 = 0;
  	int acS1, acS2, acS3, acS4, acS5 = 0;
  	int dirEnh, strEnh = 0; //direction, strength enhanced
  
  	while (true) {
  		//ULTRA code
  		if (!ultraSettingSingle) { //set single
  			if(!USsetSingleMode(ULTRA)) {
  				writeDebugStream("Error: USsetSingleMode failed!\n");
  			} else {
  				ultraSettingSingle = true;
  				ultraSetSingleStartTime = nPgmTime;
  			}
  		} else { //read value when ready
  			if ((nPgmTime - ultraSetSingleStartTime) > 100) {
  				ultraSettingSingle = false;
  				if (!USreadDistances(ULTRA, ultraDists)) {
  					writeDebugStream("Error: USreadDistances failed!\n");
  				} else {
  					nxtDisplayTextLine(1, "%3d %3d %3d %3d", ultraDists[0], ultraDists[1], ultraDists[2], ultraDists[3]);
  					nxtDisplayTextLine(2, "%3d %3d %3d %3d", ultraDists[4], ultraDists[5], ultraDists[6], ultraDists[7]);
  				}
  			}
  		}
  
  		//nxtDisplayTextLine(1, "Ultra: %d", ultraDistance);
  
  		//IR code
  		int dirDC = HTIRS2readDCDir(IRSEEK);
  		int dirAC = HTIRS2readACDir(IRSEEK);
  		HTIRS2readAllDCStrength(IRSEEK, dcS1, dcS2, dcS3, dcS4, dcS5);
  		HTIRS2readAllACStrength(IRSEEK, acS1, acS2, acS3, acS4, acS5);
  		HTIRS2readEnhanced(IRSEEK, dirEnh, strEnh);
  		nxtDisplayTextLine(3, "DC: %d AC: %d", dirDC, dirAC);
  		nxtDisplayTextLine(4, "D: %d %d %d %d %d", dcS1, dcS2, dcS3, dcS4, dcS5);
  		nxtDisplayTextLine(5, "A: %d %d %d %d %d", acS1, acS2, acS3, acS4, acS5);
  		nxtDisplayTextLine(6, "Enh Dir: %d Str %d", dirEnh, strEnh);
  	}
  
  
  }
  