This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
built_in:nxt_setonconnect [2015/03/11 07:49] madlyr [SetOnConnect] |
built_in:nxt_setonconnect [2015/03/12 01:26] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
====== SetOnConnect ====== | ====== SetOnConnect ====== | ||
- | The **SetOnConnect** 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. The **SetOnConnect** 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.\\ This function returns status of connection | + | The **SetOnConnect** 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. The **SetOnConnect** 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. |
< | < | ||
+ | Callback function myfunc. Function name changed to OnConnect. | ||
+ | <code javacsript> | ||
+ | </ | ||
====Example - Connect to NXT==== | ====Example - Connect to NXT==== | ||
Line 19: | Line 22: | ||
} | } | ||
- | function OnConnect( | + | function OnConnect( |
{ | { | ||
- | app.Alert( " | + | app.Alert( " |
} | } | ||
</ | </ | ||
Line 47: | Line 50: | ||
} | } | ||
- | function OnConnect( | + | function OnConnect( |
{ | { | ||
- | if (status) { | + | if (success) { |
app.Alert( " | app.Alert( " | ||
app.SetMenu( " | app.SetMenu( " | ||
Line 58: | Line 61: | ||
} | } | ||
</ | </ | ||
- |