DroidScript to officially support VIM devices


#1

Hi Guys,

Great News!

DroidScript is going to officially support the VIM platform, including GPIO access :smile:

The latest alpha release of DroidScript which provides support for VIM can be found here:- http://androidscript.org/alpha/DroidScript_159a2

I’ve personally tested it on Vim_Nougat_Root_170421 with no issues. Let me know if you find any issues in other versions.

Here’s an example of flipping the GPIOH5 pin from a native Android toggle button:-

//Called when application is started.
function OnStart()
{ 
	//Create a layout with objects vertically centered.
	lay = app.CreateLayout( "linear", "VCenter,FillXY" );	

	//Create a toggle button.
    tgl = app.CreateToggle( "Toggle Button", 0.4 );
    tgl.SetMargins( 0, 0.02, 0, 0 );
    tgl.SetOnTouch( tgl_OnTouch );
    lay.AddChild( tgl );
	
	//Add layout to app.	
	app.AddLayout( lay );
	
	//Setup the GPIO pin.
	sys = app.CreateSysProc("su");
   	sys.Out( "echo " + 176 + " > /sys/class/gpio/export\n" );
    sys.Out( "echo out > /sys/class/gpio/gpio" + 176 + "/direction\n" );
}


//Called when user touches our toggle button.
function tgl_OnTouch( isChecked )  
{
	if( isChecked )
		sys.Out( "echo 1 > /sys/class/gpio/gpio" + 176 + "/value\n" );
	else
		sys.Out( "echo 0 > /sys/class/gpio/gpio" + 176 + "/value\n" );
}

#2

Hi Guys,

We’ve got a new version for DroidScript specially built for VIM right here:-

http://androidscript.org/vim

Check out the following post for how to write your own Launcher/Home Screen for Android:-

http://forum.khadas.com/t/easily-create-your-own-android-home-screen