User Tools

Site Tools


Privacy Policy


Version 2.09 is out since May 6th 2021
After a brief pause DroidScript is now available again from the Google Play Store

Frequently Asked Questions


Note for contributors

If you wish to create a new page in the DroidScript wiki, please click on the most appropriate namespace above and follow the notes for contributors there.

Because of spam, it has been necessary to add a CAPTCHA to the registration form and the save option for editing pages. You will not need to prove you are human if you are logged in, so please register.

Please feel free to improve any existing page, as well as adding new pages to increase the sum of public knowledge about DroidScript.

Formatting Syntax


Table of Contents

USBSerial control


Method Description
USBSerial.SetOnReceive( callback )
USBSerial.Write( p1, mode ) mode is optional, can be “US-ASCII” (vs UTF8)


(Example taken from the DroidScript sample section)

// Simple serial transmit example. 
// Note: this application only works on devices that support  
// OTG and allow access to external serial devices. 
// Known to work: Nexus7, GalaxyS3/S4, ExperiaZUltra, TescoHudl     
// Don't work: Nexus4, GalaxyS1, AsusMemo 
//Called when application is started. 
function OnStart() 
	//Create a layout with objects vertically centered. 
	lay = app.CreateLayout( "linear", "VCenter,FillXY" );	 
	//Create a button 1/3 of screen width and 1/4 screen height. 
	btn = app.CreateButton( "Press Me", 0.3, 0.25 ); 
	lay.AddChild( btn ); 
	//Set function to call when button pressed. 
	btn.SetOnTouch( btn_OnTouch ); 
	//Add layout to app.	 
	app.AddLayout( lay ); 
	//Create USB serial object. 
	usb = app.CreateUSBSerial(); 
//Called when user touches our button. 
function btn_OnTouch() 
	//Send serial text to device. 
	usb.Write( "Hello serial device!" ); 
built_in/usbserial.txt · Last modified: 2016/01/14 00:41 (external edit)