GetBtAddress

The GetBtAddress function returns Bluetooth address of a connected NXT brick or NXT brick address given as optional obj parameter.

btAddress = nxt.GetBtAddress();
btAddress = nxt.GetBtAddress( obj );

Example - GetBtName / GetBtAddress of connected NXT

var nxt, lay, btnConnect;
function OnStart()
{
  lay = app.CreateLayout( "Linear", "VCenter, FillXY" );
  btnConnect = app.CreateButton( "Connect", 0.5, 0.1 );
  btnConnect.SetOnTouch( btnConnect_OnTouch );  
  lay.AddChild( btnConnect );
  app.AddLayout( lay );
  nxt = app.CreateNxt();
  nxt.SetOnConnected(onNXTConnected);
}	
 
function onNXTConnected() 
{
  if (nxt.IsConnected()) {
    app.ShowPopup("Connected to: "+nxt.GetBtName()+" : "+nxt.GetBtAddress());
  }
}
 
function btnConnect_OnTouch()
{        
  if (!nxt.IsConnected()) {
    //Show list of NXT devices.
    nxt.ShowDevices();
  }
}