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 17:20] 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. Callback function returns | + | 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 returns status of connection (true if connection is successful, and false, if connection failed) and caller nxt object.\\ Do not use SetOnConnected while using SetOnConnect. |
< | < | ||
Callback function myfunc. Function name changed to OnConnect. | Callback function myfunc. Function name changed to OnConnect. | ||
Line 22: | Line 22: | ||
} | } | ||
- | function OnConnect( | + | function OnConnect( |
{ | { | ||
- | app.Alert( " | + | app.Alert( " |
} | } | ||
</ | </ | ||
Line 50: | Line 50: | ||
} | } | ||
- | function OnConnect( | + | function OnConnect( |
{ | { | ||
- | if (status) { | + | if (success) { |
app.Alert( " | app.Alert( " | ||
app.SetMenu( " | app.SetMenu( " | ||
Line 61: | Line 61: | ||
} | } | ||
</ | </ | ||
- |