#pragma config(Sensor, S3,     light,               sensorLightActive)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

#include "XbeeTools.h"

// Robot A (leader)

task main()
{
  InitRS485();

  nMotorEncoder[motorB] = 0;

  while (SensorValue[light] > 30)  // move fwd until blk line
  {
    motor[motorB] = 50;
    motor[motorC] = 50;
  }

  motor[motorB] = 0;  // stop robot at black line
  motor[motorC] = 0;

  // store forward motion of robot in variable count
  int count = nMotorEncoder[motorB];

  wait1Msec(1000);

  // create string variable to store message
  string messageToSend;

  // convert integer encoder counts to a string
  StringFormat(messageToSend, "%d", count);

  // transmit string message
  SendString(messageToSend);

}
