I tried like this, the adapter is connected, but the output does not come (apparently necessary to pass initialization, as stated in that article. Only some of the team Need daughter?
//Called when application is started.
function OnStart()
{
//Create a layout with objects vertically centered.
lay = app.CreateLayout( "linear", "VCenter,FillXY" );
btn2 = app.CreateButton( "подключить" );
btn2.SetOnTouch( conne);
lay.AddChild( btn2 );
//Create a text label and add it to layout.
btn = app.CreateButton( "speed" );
btn.SetOnTouch( SendSpeedCommand );
lay.AddChild( btn );
txxt = app.CreateTextEdit("",0.8,0.1 );
lay.AddChild( txxt );
btn3 = app.CreateButton( "new command" );
btn.SetOnTouch( newcommand );
lay.AddChild( btn3 );
elm327 = app.CreateBluetoothSerial();
elm327.SetOnReceive(elm327DataReceived);
elm327.SetSplitMode("End","\r"); // change the character to match the ELM protocol, example uses "\n"
//This name is not the MAC, but the name you can look in the BT Settings > paired devices
elm327.SetOnConnect( con );
app.AddLayout( lay );
}
function newcommand()
{
sendToElm327(txxt.GetText());
}
function conne()
{
elm327.Connect("OBDII");
}
function con(ok)
{
if(ok)
app.ShowPopup( "connection" );
else
app.ShowPopup( "no connection" );
}
function elm327DataReceived(data) {
app.ShowPopup( data );