
leonardo46
Italy
Asked
— Edited

I'm a basic and assembler programmer ( PIC MCUs). I'm trying to put ezb scripts at work. I have a pot connected to adc0 (i.e. 0-3.3 V) and move the pot. I write this easy script in movement script, triggered by "forward" action panel :
sayezbwait("man") :auto $av=getadc(adc0) if $av>20 sayezbwait("dog") else sayezbwait("cat") endif goto(auto)
"man" is spoken once. Nothing else happens. I should have missed some banal detail Please help.
PTP, thanks for the answer. I don't want to hijack this thread so no need to respond to my posts on my script questions anymore. However just to answer you; I'm still just a student of easy script and have no advance. I'm just asking questions to learn. I'm amazed at the different ways we can write script and have it do the same thing. For example I thought you could only have one If statements in a block and everything else needed to compare to it. Then each If block needed it's own EndIf statement. I didn't know you could stack them up at the bottom like you do. I write my scripts much like you've second example to my. That's more readable to me. Lol
Anyway, ignore me now. Sounds like the op is getting close to resolution. I wish him luck.
Leonardo, click the pause box on the adc monitors. This is probably what is slowing down your setup. That feature is very resource hungry. I can't run more than one at a time without seeing my system slow to a crawl. See if this helps.
@leonardo,
Please try:
test_r1.EZB
OK PTP. Now it works. I'll study your code to learn what you have done.
But the problem now is : WHY it's so slow ? it takes at least 3 seconds to actually change the direction. Within that time the robot will crash against the wall ! The same robot , with a PIC, reacted in milliseconds.
@leonardo,
Please try: test_r1.EZB
Changes:
*** #1 edit:begin *** 3) Dave suggestion, is very relevant.
I paused all the analog controls, they have short (<1000ms) refresh intervals .
Our focus is to troubleshoot the navigation script. You can try later activate one by one to see if they affect the performance
*** #1 edit:end ***
as it is, is using a single read on adc0 to use average readings you will need change the code to:
Please let me know if the results are better.
PS: Congratulations Soccer Euro 2016 - Italy is moving forward ! Conte did a fantastic job beating Spain is not easy!
As far as being slow, did you see my post above. Give that a try to see if it helps.
Dave it doesn't help. Same delay.
PTP. This version doesn't connect to ezb#0. . timed out. I don't understand what's going on. It connects to other ezbs, #1,2,etcthat I don't have. No test possible.
Thanks for our soccer team. They were really convinced to win.