DroidScript wiki

(was AndroidScript) unofficial documentation by the community

User Tools

Site Tools


built_in:nxt_setlampcolor

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

built_in:nxt_setlampcolor [2015/03/09 16:21] (current)
octazid created
Line 1: Line 1:
 +====== SetLampColor ======
  
 +The **SetLampColor** function commands the NXT brick to set the color sensor lamp to one of the following: ​    
 +  * '​White'​
 +  * '​Red'​
 +  * '​Green'​
 +  * '​Blue'​
 +  * '​Off'​
 +
 +The **input** parameter should be an NXT input port number between 1 and 4 (which the color sensor is plugged into).
 +<​code>​nxt.SetLampColor( input, color );</​code>​
 +
 +====Example - Set lamp in port 3 to red====
 +<code javascript>​
 +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"​ );
 +}
 +</​code>​
built_in/nxt_setlampcolor.txt ยท Last modified: 2015/03/09 16:21 by octazid