Table of Contents

SetLampColor

The SetLampColor function commands the NXT brick to set the color sensor lamp to one of the following:

The input parameter should be an NXT input port number between 1 and 4 (which the color sensor is plugged into).

nxt.SetLampColor( input, color );

Example - Set lamp in port 3 to red

function OnStart()
{
  nxt = app.CreateNxt();
  app.SetMenu( "Connect,SetLampColor" );
}
 
function OnMenu( name )
{
  if( name=="Connect" )
    nxt.ShowDevices();
  else if( name=="SetLampColor" )
    nxt.SetLampColor( 3, "Red" );
}