User Tools

Site Tools


built_in:nxt_setonconnected

Differences

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

Link to this comparison view

built_in:nxt_setonconnected [2015/03/10 16:30]
madlyr
built_in:nxt_setonconnected [2015/03/11 15:50]
Line 1: Line 1:
-====== 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! 
-<code>nxt.SetOnConnected( myfunc );</code> 
- 
-====Example - Connected to NXT==== 
-<code javascript> 
-function OnStart() 
-{ 
-  nxt = app.CreateNxt(); 
-  nxt.SetOnConnected( OnConnect ); 
-  app.SetMenu( "Connect" ); 
-} 
- 
-function OnMenu( name ) 
-{ 
-  if( name=="Connect" ) 
-    nxt.ShowDevices(); 
-} 
- 
-function OnConnect() 
-{ 
-  app.ShowPopup( "Connected!" ); 
-} 
-</code> 
built_in/nxt_setonconnected.txt ยท Last modified: 2015/03/11 15:50 (external edit)