text: #pragma config(Sensor, S1,     HTIRL,               sensorLowSpeed)
  //*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//
  
  /*
   * $Id: HTIRL-test1.c 20 2009-12-08 22:59:13Z xander $
   */
  
  /**
   * HTIRL-driver.h provides an API for the HiTechnic IR Link Sensor.  This program
   * demonstrates how to use the Power Functions API to control up to 8 motors.
   *
   * Changelog:
   * - 0.1: Initial release
   * - 0.2: More comments
   *
   * Credits:
   * - Big thanks to HiTechnic for providing me with the hardware necessary to write and test this.
   *
   * License: You may use this code as you wish, provided you give credit where it's due.
   *
   * THIS CODE WILL ONLY WORK WITH ROBOTC VERSION 2.00 AND HIGHER.
   * Xander Soldaat (mightor_at_gmail.com)
   * 25 November 2009
   * version 0.2
   */
  
  #include "drivers/HTIRL-driver.h"
  
  /*
    =============================================================================
    main task with some testing code
  
   */
   task main {
    int MotorA_cmd = 0;
    int MotorB_cmd = 0;
  
    nxtDisplayCenteredTextLine(0, "HiTechnic");
    nxtDisplayCenteredBigTextLine(1, "IRLink");
    nxtDisplayCenteredTextLine(3, "Test 1");
    nxtDisplayCenteredTextLine(5, "Connect sensor");
    nxtDisplayCenteredTextLine(6, "to S1");
    wait1Msec(2000);
    eraseDisplay();
    // Test the motors and recievers.
    for (MotorA_cmd = 0; MotorA_cmd < 16; MotorA_cmd++) {
      MotorB_cmd = 15 - MotorA_cmd;
      // PFcomboPwmMode allows you to control the speed of the PF motors.
      // There are 7 forward speeds and 7 reverse speeds, brake and halt
      PFcomboPwmMode(HTIRL, 0, (eCPMMotorCommand)MotorB_cmd, (eCPMMotorCommand)MotorA_cmd);
      PFcomboPwmMode(HTIRL, 1, (eCPMMotorCommand)MotorB_cmd, (eCPMMotorCommand)MotorA_cmd);
      PFcomboPwmMode(HTIRL, 2, (eCPMMotorCommand)MotorB_cmd, (eCPMMotorCommand)MotorA_cmd);
      PFcomboPwmMode(HTIRL, 3, (eCPMMotorCommand)MotorB_cmd, (eCPMMotorCommand)MotorA_cmd);
    }
  
    PlaySound(soundDownwardTones);
    while (bSoundActive) {}
  
    for (MotorA_cmd = 0; MotorA_cmd < 4; MotorA_cmd++) {
      MotorB_cmd = 3 - MotorA_cmd;
      // PFcomboDirectMode does not allow speed control.  The motor is either
      // going full speed forward or reverse.  You can also brake and float the
      // motor.
      PFcomboDirectMode(HTIRL, 0, (eCDMMotorCommand)MotorB_cmd, (eCDMMotorCommand)MotorA_cmd);
      PFcomboDirectMode(HTIRL, 1, (eCDMMotorCommand)MotorB_cmd, (eCDMMotorCommand)MotorA_cmd);
      PFcomboDirectMode(HTIRL, 2, (eCDMMotorCommand)MotorB_cmd, (eCDMMotorCommand)MotorA_cmd);
      PFcomboDirectMode(HTIRL, 3, (eCDMMotorCommand)MotorB_cmd, (eCDMMotorCommand)MotorA_cmd);
    }
  }
  
  /*
   * $Id: HTIRL-test1.c 20 2009-12-08 22:59:13Z xander $
   */
  