User Tools

Site Tools


built_in:nxt_getbtaddress

Differences

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

Link to this comparison view

built_in:nxt_getbtaddress [2015/03/11 10:13]
madlyr created GetBtAddress
built_in:nxt_getbtaddress [2015/03/11 18:25]
Line 1: Line 1:
-====== GetBtAddress ====== 
  
-The **GetBtAddress** function returns Bluetooth address of a connected NXT brick.  
-<code>btAddress = nxt.GetBtAddress();</code> 
- 
-====Example - GetBtName / GetBtAddress of connected NXT==== 
-<code javascript> 
-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(); 
-  } 
-} 
-</code> 
built_in/nxt_getbtaddress.txt ยท Last modified: 2015/03/11 18:25 (external edit)