This shows you the differences between two versions of the page.
built_in:usbserial [2015/03/22 13:27] octazid completed |
built_in:usbserial [2016/01/14 00:41] |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== USBSerial control ====== | ||
- | ===== Methods ===== | ||
- | ^Method ^Description ^ | ||
- | |USBSerial.SetOnReceive( callback ) | | | ||
- | |USBSerial.Start() | | | ||
- | |USBSerial.Stop() | | | ||
- | |USBSerial.Write( p1 ) | | | ||
- | |||
- | =====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( " | ||
- | } </ |