2017년 5월 16일 화요일

Problem with handy-Bluetooth-Arduino-communicatíon


I programmed an app with the MIT App Inventor 2 and a Arduino UNO sketch that communicate over the HC-06 bluetooth modul to control a led stripe WS2812B 5050 RGB stripe with WS2811 controller.

Like it is adviced in different internet forums I created a handshake and in the UNO sketch there is  either communication with the handy or control of the led stripe because of sharing the same interrupt in the functions.

It always starts good, but after a few minutes the app hangs.

I debuged it and it seems that the app/handy does not work quiete right.

As you can see in the screenshot "Debug_App" the app stucks in the step that the event "Slider1_Blau" was triggered ("Label1_Schritt.Text" is set to "Blau"), the flag "global Anfrage" to start the first step of the communication is true.
Now the event "Clock1_Bluetooth_Handshake.Timer" should execute "call(BluetoothClient_HC_06.SendText)" and send "text("<")" but as you can see the "Label1_Schritt.Text" isn't set to "<" but still is "Blau".
Why does that happens? The timer event is triggered every 150 ms and if the flag "global Anfrage" is true it should execute the Bluetooth call!

As you can see in the screenshot "UNO_Handshake_Protokoll" the last communication has ended corretly ("a" is always the last step in the handshake and tells the app that the data "global Wert" was recieved) and no new char was recieved.

In the screenshot "Debug_Sketch" you can see that the sketch still runs betweens "empfange" (recieve) and "zeige" (controll led).

To me it looks like the sketch has finished the communication and has not lost anything but the app does not execute the bluetooth call. :-(

Does anybody has an idea?

Shall I upload the sketch and/or the ais file?






--
Your problem is that you are sending and receiving data within the same timer event. You must have a protocol that makes sure that you have received all data from your Arduino before you are sending new data. Otherwise some buffers will overflow, or other errors will occupy r. If this is enough information to solve your problem, fine, else attach your .aia and sketch.

--
Thanks for your answer.

I understood the timer event in that way that every time it is called it would run through and execute the step that is actually true by the flags. For my understanding a handshake is a step sequence and I thought the timer event with the flags would do it that way.. 

Since I don't know how to change my app (I tried two timer but it didn't help either.) it might be the best if I upload my app and sketch.
There is much of debugging stuff in it (all the labels), three variables for the communication (Kommunikation, Anfrage, Werte) and one variable for the data (Wert).
For the Bluetooth communication man has to write his handy Bluetooth mac adress into the text string.

The sketch has the loop with both the main functions "Empfang" (recieve) and "Anzeige" (control led). The function "Emfang" calls the function "Empfangsverarbeitung" while Bluetooth is available.The function "Empfangsverarbeitung" manage the handshake and asignes the data to variables.
If Bluetooth doesn't recieve anymore data or a before called led program (for example "leddimmen") is running the function "Anzeige" is called and calles itself the subfunctions to control the led.

It took me a lot of time and struggle to come to these conclusions because I'm not a professional programmer. In the top of the sketch I'm mentioning the sources where I sampled all the information. So I'm sad that it doesn't work.

Thanks for any help. Please tell me if I shall give more comments to my app or sketch or whether I should translate it complete in English.



--
My German is OK enough, that cannot be said of my amount of time available, and of my broken laptop which I need for this. So, please some patience.

--
Some preliminary remarks:
Since your app is working at startup, the problem must be in the timing and the communication.

Why do you connect the Arduino at initialize? Personally, I think it would be better to have a button for it. I am also missing a button for disconnect.
After connecting, you must set a global indicating that you are connected. This allows you to check in the timer event whether the Arduino is indeed connected. You could loose connection by walking away with you phone, or initially it may be slow to respond.

Then, my problem with your protocol is that you are sending and receiving in the same Timer event. There could be a delay somehow which then causes out-of-sync problems. So, When you are sending, you should not receive anything, and when you are receiving, you should make sure that you received everything before you start sending again. 

Which brings me to your ReceiveText, which always only receives 1 byte. But, if you have debug on, the Arduino sends a println, which is at least 2 bytes.

Then, there is quite a bit of repeated code. Put it in a procedure! I will send an example later. To be continued.

--
I also write the application to control the LEDs WS2818, do not know much about programming, but something I have created.

The code for the Arduino and Android app is here:
https://github.com/romi06/WS2812-bluetooth
and the source code of the application is a few posts below "Button color" code itself is probably a lot of mistakes but on my Samsung S2 works ok.
Maybe something useful to you.
Google translator

--
I looked further at your app and I found a few things that you should improve.
Connection: most people have a listpicker to show the possible BT devices, and that is what my example here uses:

Then, instead of all the similar code for the buttons, when clicked, you could do something like this the blocks above. Similarly you could make a procedure that covers the three sliders.
Then, the sending of data is always triggered by pressing a button or moving the slider. Therefore there is no need to do this in the clock.Timer event. That only makes things difficult.
What you should do, is check whether the Arduino is properly connected, send the stuff and then wait for a reply.

In the clock.Timer block you should always check whether the number of available bytes to retrieve is > 0 and if so, recieve all bytes that are available, like this:
I cannot check whether your sketch is alright, but if you have debug on, you should see what is going on in your Arduino and you could display that in a label for example (in the dosomethingwithtereceivedtext procedure).
Let us know whether you are making progress.

--
thanks for your effort. The sketch and the app look really interesting. Unfortunately the app is just a *.apk file so I can't see how the communication works. Second the app isn't either in English nor in German so I can't understand and handle it. 

--
This is what I made of your app, to make more clear what should be happening (see attached .aia).
But it could be very wrong, because I do not understand what the protocol with your Arduino is.
Could you describe it in simple terms?

Like: if App sends < then Bt responds s
Wait for response
Send values, etc.

Right now it seems that you could send a full command and what you receive back is just for debugging purposes, but I am not sure.

--
Thank you very much for your big effort.

Please let me first answer to your hints and in that way explain a little bit more of what I thought my app and sketch are supposed to do (but what they obviously not do). 
Maybe that way we find the error in my thoughts and can correct my app and sketch before we try to get your app running (It did run one cycle and then did nothing more.).

You wrote that I “send and receive data within the same timer event”.
My intention was to manage the circumstances that neither the app nor the sketch are all time ready to receive data.
In the timer event I have the handshake that is a step sequence. 
If a button or a slider is moved and no communication already happens (“Kommunikation” is false) the data are written to the variable “Wert” and the flag “Anfrage” and “Kommunikation” are set.
So now every time the timer event is running through the handshake is executed. The first time because the flag “Anfrage” is true now (and “Werte” not) the bluetooth function sends the start marker “<” to the sketch. It doesn't matter whether the sketch answers immediately.
Because the next time the timer event is triggered it is still in the step “Anfrage” (“<”). And if then the “s” from the sketch is received the flag “Anfrage” becomes false and “Werte” true. So the handshake sequence is in the next step.
So my intention was that at least after some time events the data should be exchanged between the app and the sketch. 

The sketch itself is primary in the “empfange” case to handle right away incoming data. 
It only jumps into the case “zeige” if new data has arrived (in function “Empfangsverarbeitung” in case “>” of the end marker) or a led control program like “leddimmen”  needs to be run. But the control comes back to “empfange” after each run through “zeige”.
And the led control programs are non blocking because of using a timer interrupt.
For the first few times all this seems to work like my debugging shows.

I did another debug to see whether the timer event still works even though the bluetooth call isn't made and now I can see that even the timer event stuck.
This is strange. Maybe the timer event and the bluetooth call hang each other up like the Serial or SoftwareSerial function and the led control function (FastLed and Adafruit_NeoPixel. I use NeoPixel_SPI from Nick Gammon) would hang each other up if used together because both need the same interrupt (like I learned in the internet forums).
But this question can probably only be answered by the MIT Inventor team.

The numberOfBytes is set to 1 because my handshake character are only 1 byte.
If I change it to 2 it doesn't work, it stuck.

The way I establish the bluetooth connection does work if both devices are already paired. I get a message from the notifier when the connection is done. And I don't think I lose it because I'm sitting right in front of PC, handy and Arduino.
For later on when I could use my app I would make the connection as you advised it so other family members could use the app on their phones. I do know the ListPicker method but be to lazy doing it every time. But thanks for your hint.

The way you use the button and slider event in procedures is very nice and I will do it if my app works.

I reduced the debugging in the sketch to only print the handshake character and the app to only show a changing yellow point to see if the timer event works.



--
Let me try to answer your questions.

The problem with sending and receiving data in the same timer event is that if the Arduino is slow in responding, then the reading of the data gets stuck. Besides, I do not see any advantage in *sending* data withing a timer event.
Example: you move the blue slider, and the ledStripe or whatever it is, needs to do something. So, you could sent something like '<123B>' (the thumb position and a B, enclosed in square brackets. in one string and when the Arduino sketch is ready procession that, it could send an acknowledgement, maybe simply 'a'. By the way, it would be easier to process <B123> at the Arduino side, because you cannot be sure how many digits the thumbposition has, but if you position them the other way around, you can read until the > and convert the digits to an integer, and use it in your command to the leds.

Before you send the next command you should wait until an acknowledgement is received in your phone by the app. Yes, in the timer event. But you should always use BytesAvailableToReceive and not 1 or 2 or any other number. And, if your sketch is in debug mode it will send things like println('s'), which is 2 bytes, because of the line-end charcter that is included. Actually, you could use -1 as the nuber of bytes to recieve, and it will read until the next line-end, I believe, but it is less clear what is happening.

The chance that you will send a next command before you have received an acknowledgement is very slim, because human fingers are not fast enough, but you could use your globals to prevent sending a new command until an acknowledgement is received.

I do not think that the MIT APP Inventor team will give you another answer than I did above. You cannot serialize things that should be executed in parallel, and yes, the bluetooth read hangs if it cannot complete for some reason, but that has nothing to do with the timer event, only with the fact that the sketch is not able to respond in time, or responds with something you do not expect (like more bytes, or not an a or s).

I hope that it is more clear now what to do. I think my app is quite allright (except for the testing for acknowledgement), but your sketch is not yet. It would take me too much time right now to look at it and it is difficult, because I cannot test it. By the way, there exist apps and also PC terminal programs that you can use to debug your app. You can send commands that you type in a terminal setup and see the responses.
In fact it would be pretty easy to make one in AI2.

--
I will try to improve my app and my sketch with your advice.
But this will need some time because I can not work on it all the time.
I will tell about the results.
--
Take your time. It is your project. If you have questions, ask.

--

Using your Own Firebase Account with MIT App Inventor


1 Introduction
By default MIT App Inventor uses a default Firebase account provided by MIT (or the operator of an alternative version of MIT App Inventor).
We have preliminary support for people using their own Firebase account, however it is not complete and it is not secure. But it can be done.

2 Set the FirebaseURL
When you create your Firebase account, firebase will create a “URL” for you. It will look something like:
https://kicking-donkey-1293.firebaseio.com/
Set this URL as the FirebaseURL property in the App Inventor designer. Normally this field just contains the word “DEFAULT” which tells App Inventor to use the builtin MIT owned default account.
You will notice above the FirebaseURL property there is a “FirebaseToken” property which contains a long string. This is only used for the default account, and can safely be ignored.
Using the Firebase console (at http://firebase.com/) to go the security rules/settings and make sure they are empty (or set to something like {}). This will permit anyone to read or write values in your firebase account (remember: No security!). The only thing that protects your account at this point is the obscurity of your FirebaseURL (you can get a custom URL from firebase, but I recommend against getting a “guessable” URL because at this point its obscurity is your only protection!

3 Test It
At this point you should be able to access your own firebase account both from the Companion and from packaged apps. However!

4 If it doesn’t work…
It may help to understand a little about how Firebase works internally in order to debug what is likely happening.
By default whenever firebase is asked to access a variable, it first tries to do it in an unauthenticated context. If this works, then all is good. However if this doesn’t work (which it won’t with the DEFAULT firebase account) then firebase performs an authentication step which involves the FirebaseToken referenced above. This token is used to establish authentication and access control for the DEFAULT account. Once authenticated, Firebase will try again. If it gets an error once authenticated, it will return an error to the program attempting to access the variable.
There is a bug (in my opinion) in Firebase in that it caches its authentication state, even when a different URL is used (like yours). This is a particular issue with the MIT AI2 Companion App. What happens is that at some point you used the Companion with the DEFAULT account, and Firebase performed authentication against the DEFAULT account. This authentication is then kept, even across termination and restart of the Companion. So when you change the FirebaseURL to use your own account, instead of attempting to access your variables in an unauthenticated (aka not logged in) state, it uses the authentication information that was used with the DEFAULT account. However this authentication is not recognized by your firebase account and an error results.
We have provided a way to get around this. It is a little obscure, but it should work.

1. Connect to the Companion from App Inventor using an App that has a Firebase Component
2. From the blocks editor, drag out the “Unauthenticate” block into the blocks editor.
3. While connected to the Companion, use the “Do It” menu option (right click) on the Unauthenticate block.
This will “unauthenticate” (or logout) from Firebase. You only need to do this once after your change your FirebaseURL to your own account. Things should then work.

FAQ for FireBase


Firebase for 2 player game


I now have my football app working 100% thanks to the great help I have received here!!!  

Currently, player 1 chooses their move, then hands the device to player 2 to choose their move, then there is an outcome base on those choices.  It is my understanding that I can use firebase to make this playable across 2 devices (each player using their own device)  is this correct?

If so...I will be asking for guidance on how to set that up.  

--
There are two articles on Firebase in that section of this FAQ:

--

Two player game: Firebase or Fusion Table?


I'd like your opinion on which would be best to use in this scenario: Firebase or a Fusion Table.  

I have a two-player game, and when Player1 makes a move, the screen should be automatically updated on Player2's device.

Firebase seems perfect, because it will update automatically, and is easier to implement - in the Firebase.DataChange, I check for the name of the game as a tag, and, if it is this game, then I update the screen.  The string for update is quite long (about 300 pieces of data).  The downside is that, if I am Player3, playing a different game, my phone will also respond to the Firebase.DataChange command.  Because it's a different game, it won't change my screen, but if there are a thousand users all playing different games at the same time, then my device will be continually bombarded Firebase.DataChange commands, and it might impact on the speed of my game (and other possible problems?).

A FusionTable won't update automatically, but I could set a clock in the game to check the fusion table every 20 seconds.  A 20-second delay between Player1's move and the new move appearing on Player2's device is fine for my purposes.   This would have the advantage that each player would be polling the FusionTable only 3 times a minute, but then there would be a search in the fusion table, so, with a thousand entries, say, it might take a little while.

Any thoughts or comments welcome.

--
I would add one important question: Firebase is experimental and might not be available some day - is this going to change?

--
It is not very likely that Firebase would not be available some day, unless Google decides to stop providing it, but the same is true for Fusion tables.
Firebase is experimental because its functionality is not crystallized yet, so you cannot really rely on the interface. This also means that you should not use it for apps that you want to publish in the Playstore (yet).
For now, your best bet is Fusion tables, unless you like experimenting - then tell us how you do after a while.

You are right to worry about scalability up front.

I haven't verified this for recent Firebase updates, but the part of the 
Designer component that restricts your app to a designated subset
of a shared firebase db might also control the scope of the Data Changed
callback events you receive.  So if you extend that attribute to include a game ID,
that might work.

For an entirely different approach, consider direct message passing
via SMS or BlueTooth, to bypass server problems or reduce the server
role to just matchmaking.

--
alternatively you also could use PubNub, which offers long polling

--

Runtime error after installing APK, works fine in dev mode


I am using App Inventor 2 on Win7 with Chrome 31.
My app is a game involving two UFO's, a bomb, a bullet and two sprites representing explosions.
When I developed the game, I used the AI Companion 2 to see the result. All went well, and I created a package to test it out on some other devices. The first one of course was the same phone (Samsung Google Nexus, Android 4.3) I developed it on.
To my surprise it throws a runtime error the moment it is started. I can see the app doing the right stuff in the background, but the Runtime error/End application dialog is flashing in the foreground.
I tried to find something in the logs through "Android System Info" app, but could not find anything.
Please advise.
--
can you send the source so we can have a look?

--
Thanks for the interest and quick reply.
I don't mind sharing the code, of course. It is quite big though... especially if I have to share a screendump of the blocks. Will this work: http://ai2.appinventor.mit.edu/#61960017? Or should I share it in another way?
After my post, I found the post on the nested join, I had that too, but fixing it using the mutator didn't help.
--
Go to 'My Porjects' page, click on the project you want to export,
then go to 'Project --> export' and it will download as an aia file.
You can attach that to your report.

--
Sorry, when I say 'click' I mean on the checkbox beside the project,
not on the project itself.

--
You need to check your timers; one of them (don't know which one) is
throwing exceptions all the time and making the app crash; it even crashed my phone. 

--
The only timer that's enabled from the start of the app is the one for the bomb.
I reduced it to this and still it crashes.
How did you find out one of the timers was responsible?

Inline image 1

--
you can attach your devive through USB and use 'adb logcat': http://developer.android.com/tools/help/logcat.html
You need to have the Android SDK installed though.

--
I attached the USB cable, and got a log showing the stacktrace of the runtime error. No matter how I simplify the app (I removed the timer given above, then the edge reached) I still get an error like this:
W/System.err( 9255): java.lang.NullPointerException
W/System.err( 9255):    at gnu.kawa.functions.ApplyToArgs.applyN(ApplyToArgs.java:163)
W/System.err( 9255):    at appinventor.ai_jhvanderven.UFO_timer_problem.Screen1.ufo$TouchUp(Screen1.yail:72)

The last line depends on what I remove... It has been the bomTimer and the badufo, and now it is the ufo...
The rest of the trace is the same:
W/System.err( 9255):    at appinventor.ai_jhvanderven.UFO_timer_problem.Screen1$frame.apply2(Screen1.yail:10239)
W/System.err( 9255):    at gnu.expr.ModuleBody.applyN(ModuleBody.java:230)
W/System.err( 9255):    at appinventor.ai_jhvanderven.UFO_timer_problem.Screen1$frame.applyN(Screen1.yail)
W/System.err( 9255):    at gnu.expr.ModuleMethod.applyN(ModuleMethod.java:222)
W/System.err( 9255):    at gnu.kawa.functions.ApplyToArgs.applyN(ApplyToArgs.java:139)
W/System.err( 9255):    at gnu.kawa.functions.Apply.applyN(Apply.java:70)
W/System.err( 9255):    at gnu.mapping.ProcedureN.apply2(ProcedureN.java:39)
W/System.err( 9255):    at appinventor.ai_jhvanderven.UFO_timer_problem.Screen1.dispatchEvent(Screen1.yail:10120)
W/System.err( 9255):    at com.google.appinventor.components.runtime.EventDispatcher.delegateDispatchEvent(EventDispatcher.java:219)
W/System.err( 9255):    at com.google.appinventor.components.runtime.EventDispatcher.dispatchEvent(EventDispatcher.java:197)
W/System.err( 9255):    at com.google.appinventor.components.runtime.Sprite$1.run(Sprite.java:366)
W/System.err( 9255):    at android.os.Handler.handleCallback(Handler.java:730)
W/System.err( 9255):    at android.os.Handler.dispatchMessage(Handler.java:92)
W/System.err( 9255):    at android.os.Looper.loop(Looper.java:137)
W/System.err( 9255):    at android.app.ActivityThread.main(ActivityThread.java:5103)
W/System.err( 9255):    at java.lang.reflect.Method.invokeNative(Native Method)
W/System.err( 9255):    at java.lang.reflect.Method.invoke(Method.java:525)
W/System.err( 9255):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
W/System.err( 9255):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
W/System.err( 9255):    at dalvik.system.NativeStart.main(Native Method)
Any thoughts?
--
keep removing timers until you find the offender. Make sure you have copies of your app though.
--
I disabled all event blocks. The app then starts without errors. And without functionality :-(

I then enabled a few that will not be called because they are activated by the other blocks. That also ran error free.

Then I enabled the first interaction: dragging the ufo around, that also worked.

Next I enabled the TouchUp event on the ufo: the error occurred once the touch up event fires for the first time:
W/System.err(32103): java.lang.NullPointerException
W/System.err(32103):    at gnu.kawa.functions.ApplyToArgs.applyN(ApplyToArgs.java:163)
W/System.err(32103):    at appinventor.ai_jhvanderven.UFO_timer_problem.Screen1.ufo$TouchUp(Screen1.yail:71)
W/System.err(32103):    at appinventor.ai_jhvanderven.UFO_timer_problem.Screen1$frame.apply2(Screen1.yail:10239)

Then I looked at the TouchUp block, and I could not find anything wrong with it. Just to make a change I removed the calls to global variables (one getter, one setter). The event fired without an error. The sound plays, the rocket starts to move from the correct spot.

Then I put the calls back in, but changed not variable to variable = false. Luckily the error reoccurred...

Now I don't know what to try next. Here's the function:
Inline image 1
So without the get and the set, it works, but with it an runtime error is raised.

Please advise.

--
Can you think of a small project in which you can use a simple sprite with a touch up action and use a similar structure?
It might be a problem in AI, but we would need an example that isolates the error and makes it repeatable so we can have a look.
If you have the same problem in a different (and smaller) project, it could indicate a problem in AI and not in your code. Does that make sense?
--
I think I found it.
My project contains an unused clock called 'begin'. If I remove that, the errors go away.
If you want to confirm, here is a smaller version of the game that shows the error one time, if you touchup the ufo.



--
Good to hear it's sorted!


--
I have a problem as well I don't know what the problem comes from but it is then i initialize the option menu.
this is one of my school projects and there is 3 red errors and 3 yellow errors that i don't know why they are there.
please answer quickly. A_A

--
Here is the problem.  You have to set initialize global sound to     a text       ....the other errors are similar.
When you get a red triangle error indicator, look for the blocks in your code that show a red triangle.  Left click the triangle and you will get a message that may help you.
Also, rather than send an aia file, it is usually better to post an image of the blocks causing the problem.
Looks like a nice game.     Have fun with it and let us know when you fix your blocks.    Have fun.
--
I have the same problem,and I don't know what the wrong with my program,why it always show runtime error?Maybe the setting of my clock has some problems?
Hope for answering

--
@ Yolan      You could temporarily disable the Clock1.Timer block.   Right mouse click anywhere on the Clock1.Timer, then select Disable Block. The entire block will turn gray; Now run the program and see if you get the error message.   If you still get the error when the clock is disabled, then the issue is probably within your Timer block.

When you finish the test,  right click on the Clock1.Timer block again.  This time select  Enable Block from the pop up.and it takes you  back where you started.

You may want to save an aia file before you do that.

If there is an error in the Timer, where is it?   I suspect the first block may be part of  the problem.  As coded, the first time the clock fires, time left is decreased by 1.  Where do you initially set the timeleft2.text block?    Is it hard coded, set in the Designer or where.   If the value is unset when the clock fires, the value will be   -1 and subsequently any negative number perhaps.  That might be what you want to do .. you get is a set of negative values that never stops resetting timeleft2.text .

What might be the problem is related to how you set the IF statement.  Where do you set the  global time to equal zero ?... to turn off the clock/  and how do you use the time.  At the moment, " i " is   either 1 to 9    .  If the value is 3 the else is executed.  Is that what you want?    or do you really mean  <= 3 in the first IF and >3 in the else if block? Would the way you set the equality cause the error?   I do not know, you have to run your app and test it and change the values.

--

ERROR List Index too large


My data Format is (27/61/123*      
start char is ( 
End character is *
data is 27  61 123 
how to display the data into corresponding text field and store in database

Here i attached my aia file 

Error is 

Select List Item: attempt to set item num 2 of a list of length 0:( )
how to solve the problem pl help me



--
Your problem might come from the parse procedure.
Unfortunately,  App Inventor can't show local procedure arguments with the DoIt right-click command.

If you rig your blocks with global test point variables, that will give you places to
catch the problem as you trace your values.

Here is an example...

--


Indexing and Listpicker


Please help me if you can to get me out of the issue.

I have defined variables like:

Initialize global places to make a list(A, B, C, ........I, J)
Initialize global lat to make a list(78.65787876, 78.74635377, 78.35363627............78.93637372, 78.46463729) 
Initialize global long to make a list(38.47463728, 38.4683483749, 38.4682732837..........38.74387427, 38.79389238)
Initialize global CM1 to make a list(abc, cde, def,.........ghi, ijk)

I have used two buttons; one for showing all records(showAllRecord) and another for searching particular record (search button).

Now when I press ShowAllRecord(for showing all CM1 values), I am getting all records and after that when I click on particular record, its also showing me corresponding lat,long values.
Please check blocks for show all record.

But when I search for particular record, I too get the result and when I click on the result, its showing lat,long values for the first record.

Means if I use ShowAllRecord button I can see all values from abc, cde, def,.........ghi, ijk and if I select 'ghi' record, its showing me corresponding value i.e: (78.93637372, 38.74387427)

But when I search for ghi record using Search button, I can see "ghi" in result and when I click on the result, its showing me value of lat. long for the 1st record i.e: (78.65787876, 38.47463728)


Can you help me so I can get the correct value when I search for any record.



--
Other recipients: priyanka...@gmail.com
Why do you keep clearing all the data from your TinyDB in your showall procedure?
TinyDB is meant for persistent data across sessions.

Also, you gave TinyDB a name, Library.
I hope you realize that you only get one TinyDB, no matter what you call it or how many of them you add.

Use the DoIt (right click) feature to trace the values from right to left in your search blocks.
That should show you where you are going wrong.

--


Translator Issue


I found an issue in Yandex Translator in MIT App-inventor 2.It doesn't translate from English to Indian languages (like Hindi,Tamil,Telugu etc....).when I try to translate , It shows error 2202 . I use language codes to translate one language to another language .Why it shows that error? 

--
It appears Yandex does not yet support those languages perhaps  Error 2202 is frequently used when a user name (perhaps language code) is invalid.

Some of the Yandex language codes from

Yandex Country Codes unofficial
ar =Arabic
az =Azerbaijani
be =Belarusian
fr =French
he =Hebrew
hr =Croatian
nl =Dutch
no =Norwegian
pl =Polish
bg =Bulgarian
bs =Bosnian
ca =Catalan
cs =Czech
da =Danish
de =German
el =Greek
en =English
es =Spanish
et =Estonian
fi =Finnish
hu =Hungarian
hy =Armenian
id =Indonesian
is =Icelandic
it =Italian
ka =Georgian
lt =Lithuanian
lv =Latvian
mk =Macedonian
ms =Malay
mt =Maltese
pt =Portuguese
ro =Romanian
ru =Russian
sk =Slovak
sl =Slovenian
sq =Albanian
sr =Serbian
sv =Swedish
tr =Turkish
uk =Ukrainian
vi =Vietnamese
zh =Chinese

unless  Hindi,Tamil,Telugu were added since this tutorial was written 

Poor Richard…an AI2 Multilingual Tip of Day app and Tutorial using TTS and Yandex Translate

Where are you getting information that Hindi,Tamil,Telugu are among Yandex supported languages Sai?

--
Please keep the conversation in the forum Sai.  Thank you.

You eMailed   In that case how i translate indian(Hindi,Tamil,Telugu) languages using yandex translator ? please give solution for this...

Translating an app to multiple languages is not difficult, see the tutorial here  

Polyglot … a multilingual tutorial for App Inventor 2

The technique involves in the developer providing translations for every component, label and text in the app.

If a language is not in Yandex's lexicon, you may have to use that method.     I know of no other translation scheme that can be used with App Inventor2, perhaps another user will provide specific advice.

If you want automatic translation of all text, that might not be possible with App Inventor for the languages you are interested in.   A possibility might be to use the ActivityStarter and point to the Google Translate page  https://www.google.com/search?q=google+translate&oq=google+translate&aqs=chrome..69i57j69i64.3311j0j4&sourceid=chrome&es_sm=93&ie=UTF-8... awkward but this could  work for you.  Also you might use AI2 in conjunction with  https://play.google.com/store/apps/details?id=com.google.android.apps.translate&hl=en  

This article shows which languages are supported by Google Translate  https://en.wikipedia.org/wiki/Google_Translate.   I think Hindi,Tamil,Telugu are included.

Edit:  I just found the  'official' list of supported Yandex languages --     https://help.yandex.com/webmaster/robot-workings/supported-languages.xml    .  This updated list shows you cannot use Yandex to do what you want to do.

--

Yandex Translate Error 2202


Error 2202: The translation service is not available; Please try again later.

Has anyone else had this problem?
Does anyone know how to fix it?  What is the correct code required to make Yandex Translate work?

--