This shows you the differences between two versions of the page.
built_in:usbserial [2016/01/13 16:41] 68.111.139.51 [Table] Added secret mode option to USBSerial.Write |
built_in:usbserial [2016/01/14 00:41] |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== USBSerial control ====== | ||
- | ===== Methods ===== | ||
- | ^ Method | ||
- | | USBSerial.SetOnReceive( callback ) | | | ||
- | | USBSerial.Start() | ||
- | | USBSerial.Stop() | ||
- | | USBSerial.Write( p1, mode ) | mode is optional, can be " | ||
- | |||
- | =====Example===== | ||
- | //(Example taken from the DroidScript sample section)// | ||
- | <code javascript> | ||
- | // | ||
- | // | ||
- | // | ||
- | // | ||
- | // | ||
- | // | ||
- | // | ||
- | |||
- | // | ||
- | function OnStart() | ||
- | { | ||
- | // | ||
- | lay = app.CreateLayout( " | ||
- | |||
- | // | ||
- | btn = app.CreateButton( " | ||
- | lay.AddChild( btn ); | ||
- | |||
- | // | ||
- | btn.SetOnTouch( btn_OnTouch ); | ||
- | |||
- | // | ||
- | app.AddLayout( lay ); | ||
- | |||
- | // | ||
- | usb = app.CreateUSBSerial(); | ||
- | } | ||
- | |||
- | // | ||
- | function btn_OnTouch() | ||
- | { | ||
- | // | ||
- | usb.Write( " | ||
- | } </ |