This shows you the differences between two versions of the page.
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. | ||
- | < | ||
- | |||
- | ====Example - GetBtName / GetBtAddress of connected NXT==== | ||
- | <code javascript> | ||
- | var nxt, lay, btnConnect; | ||
- | function OnStart() | ||
- | { | ||
- | lay = app.CreateLayout( " | ||
- | btnConnect = app.CreateButton( " | ||
- | btnConnect.SetOnTouch( btnConnect_OnTouch ); | ||
- | lay.AddChild( btnConnect ); | ||
- | app.AddLayout( lay ); | ||
- | nxt = app.CreateNxt(); | ||
- | nxt.SetOnConnected(onNXTConnected); | ||
- | } | ||
- | |||
- | function onNXTConnected() | ||
- | { | ||
- | if (nxt.IsConnected()) { | ||
- | app.ShowPopup(" | ||
- | } | ||
- | } | ||
- | |||
- | function btnConnect_OnTouch() | ||
- | { | ||
- | if (!nxt.IsConnected()) { | ||
- | //Show list of NXT devices. | ||
- | nxt.ShowDevices(); | ||
- | } | ||
- | } | ||
- | </ |