You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

#pragma config(Sensor, S1,     colorPort,           sensorCOLORFULL)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

task main()
{
  string sColor;

  while (true) {
    switch (SensorValue[colorPort])
    {
      case BLACKCOLOR:    sColor = "Black";     break;
      case BLUECOLOR:     sColor = "Blue";      break;
      case GREENCOLOR:    sColor = "Green";     break;
      case YELLOWCOLOR:   sColor = "Yellow";    break;
      case REDCOLOR:      sColor = "Red";       break;
      case WHITECOLOR:    sColor = "White";     break;
      default:            sColor = "???";       break;
    }
    nxtDisplayCenteredTextLine(2, sColor);
    wait1Msec(50);
  }
}

v

c

d

s

  • No labels
You must log in to comment.