R1D1
First off, let me say thank you to all of you who have been so helpful. I'm a newbe with ARC, so I really appreciate the assistance.
I'm having trouble with a script getting hung up, or stopping because of an error. It's a fairly striaght forward script, just moving a pan servo with my HCsr04 sonar on it, looking for obstacles, and directing the drive motors. Someone was very helpful in pointing out the Variable watch as this was a great help in debugging. I also used the Console to watch the code execute, and finally got it working the way I expected it too.
Then I downloaded the same code to my tablet and the code hangs up apparently early in its execution. First off, I don't understand why it would work on my PC and not on the tablet, I know the tablet does not have all of the functionality as the PC, but I'm only using the following commands;
If/then servo() servospeed() goto() print() sleep() getping() return()
Is there a way to watch it execute on the tablet the way you can use the Console on the PC so I can debug this?
Thanks
You can run a script and watch the output on the mobile interface. However, it's the same complied as the PC version. Can you share your code?
sure, be glad to share it. Some of it is commented out only because I'm debugging it and trying to see which parts are causing problems, but as it stands now it works from the PC. Please let me know if I didn't use the UBB Code properly;
what tool can I use to watch the code execute from my mobile device?
Use the script control. There are many suggestions for your code - I'm on my phone at the moment and will not be in front of a computer for another few hours to edit it.
You need to add a sleep command in this section. Can you see where?
:DirectionDecision Servo(D0,108) Servo(D1,108)
Servo(D0,98) Servo(D1,118) sleep(2000)
Servo(D0,108) Servo(D1,108)
This may not be your main problem but it will get this section working.
Thank you, it's obvious to me now, but not before. I need to insert a sleep command after the first two lines above because I'm giving the servos a command and not allowing time for it to be fulfilled.
Still don't understand though why this would work from the PC and just not on the tablet? I would like to be able to debug from the tablet in the future. Above you said to use the Script Control, but I don't see this on the tablet anywhere. I looked under the controls tab and the closest thing I could find is the "Script Manager", but that says it's not available on the mobile.
I thought it was obvious above on where to put the sleep command, but perhaps I guessed it wrong because my script still does not work on my mobile, but does work from my PC after inserting the sleep command after the first two lines above.
sorry to be a bother, but I would appreciate it if you could tell / show me where to find the script control you are referring to above. I have looked all over in the ARC for it, but don't see it. I've found the Variable watch, which works, but doesn't give me every thing I need to debug my mobile script. The Script Monitor and Script Console are not enabled for Mobile.
I need to debug it from the mobile because my script works when run from my PC and when I open the script to edit it and click on the run script, but does not work when run from my mobile app.
Thanks in advance for any direction.
There should be no difference between the desktop PC version and the Mobile version. Scripts run the same on both.
You can use temporary flags to help debugging, it's what I did when scripting anything. This is as simple as using something like $DebugFlag0 = 1
Pop those in various places, rename them if needed i.e. $SonarFault = 1 and watch the variable watcher. If it doesn't error on the PC then it wont error on the tablet. If it does have strange behaviour on the tablet then the problem lies in the OS or software on the tablet and I would suggest removing and reinstalling everything again on the tablet.
Another thing you could do is add an LED which will blink at specific points in the script. While running from the tablet count the blinks, you can then find out exactly where the script is when it fails.
To add, on the PC, if you are debugging a script in the script control it runs slower. This is important to note when you are relying on time i.e. the sleep commands or the time it takes to compute so many commands.
Thanks for the good suggestions, I will try the variable flag to watch in the variable watcher.
There is a definite difference between running my script from my pc & tablet, as I have done it several times. I hadn't thought about the tablet is being the issue, as I have run about half a dozen other scripts without issue. I even got a notice last week that there is an update for my android is, and am putting off installing it because I was afraid of software conflicts with ARC.
Thanks again, will give it a shot.
Thanks Rich