This shows you the differences between two versions of the page.
built_in:nxt_setonconnected [2015/03/09 16:22] octazid created |
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. | ||
- | < | ||
- | |||
- | ====Example - Connected to NXT==== | ||
- | <code javascript> | ||
- | function OnStart() | ||
- | { | ||
- | nxt = app.CreateNxt(); | ||
- | nxt.SetOnConnected( OnConnect ); | ||
- | app.SetMenu( " | ||
- | } | ||
- | |||
- | function OnMenu( name ) | ||
- | { | ||
- | if( name==" | ||
- | nxt.ShowDevices(); | ||
- | } | ||
- | |||
- | function OnConnect() | ||
- | { | ||
- | app.ShowPopup( " | ||
- | } | ||
- | </ |