User Tools

Site Tools


built_in:nxt_isconnected

Differences

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

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
built_in:nxt_isconnected [2015/03/10 21:00]
madlyr
built_in:nxt_isconnected [2015/03/11 18:03] (current)
Line 6: Line 6:
 ====Example - IsConnected Connect / Disconnect to NXT with FontAwesome icons==== ====Example - IsConnected Connect / Disconnect to NXT with FontAwesome icons====
 <file javascript NxtConnect.js> <file javascript NxtConnect.js>
-var nxt, lay;+var nxt, lay, btnConnect;
 function OnStart() function OnStart()
 { {
   lay = app.CreateLayout( "Linear", "VCenter, FillXY" );   lay = app.CreateLayout( "Linear", "VCenter, FillXY" );
- 
   //Create Connect button.   //Create Connect button.
   btnConnect = app.CreateButton( "[fa-plug] Connect", 0.5, 0.08, "Gray,FontAwesome" );   btnConnect = app.CreateButton( "[fa-plug] Connect", 0.5, 0.08, "Gray,FontAwesome" );
Line 17: Line 16:
   btnConnect.SetOnTouch( btnConnect_OnTouch );     btnConnect.SetOnTouch( btnConnect_OnTouch );  
   lay.AddChild( btnConnect );   lay.AddChild( btnConnect );
- 
   app.AddLayout( lay );   app.AddLayout( lay );
  
Line 28: Line 26:
     if (nxt.IsConnected()) {     if (nxt.IsConnected()) {
         btnConnect.SetText("[fa-unlink] Disconnect");         btnConnect.SetText("[fa-unlink] Disconnect");
-        app.ShowPopup( "Connected to Bluetooth device: "+nxt.GetBtName() + " : " + nxt.GetBtAddress() );+        app.ShowPopup("Connected to Bluetooth device: "+nxt.GetBtName()+" : "+nxt.GetBtAddress());
     }     }
 } }
built_in/nxt_isconnected.1426021223.txt.gz ยท Last modified: 2015/03/11 05:00 (external edit)