Table of Contents

SetOnConnected

The SetOnConnected function allows you to set the name of a function that you would like to be called when the NXT has been successfully connected via Bluetooth.
Do not use SetOnConnect while using SetOnConnected!

nxt.SetOnConnected( myfunc );

Example - Connected to NXT

function OnStart()
{
  nxt = app.CreateNxt();
  nxt.SetOnConnected( OnConnected );
  app.SetMenu( "Connect" );
}
 
function OnMenu( name )
{
  if( name=="Connect" )
    nxt.ShowDevices();
}
 
function OnConnected()
{
  app.ShowPopup( "Connected!" );
}