
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.
Leonardo,
My ezb has a different address, when you save a project the ip address goes in.
You see a textbox before the connect button, you will need to change the ip address from 192.168.18.84 (mine) to 192.168.1.1 (yours).
Then save the project.
OK, PTP, much better. Reaction time decreased from 3 sec to 1 sec. Good. It's almost ok. I'll experiment for even better performance.
Another issue for this robot was some code to avoid endless oscillations between right and left occurring in some circumstances. It's necessary, when ,for example, turning right, to disable any attempt to turn left until the front sensor has a free space before it. Turning left should be enabled only after the rover has started to go straight. Same thing should happen for turning left. To do this there were two flags FL and FL1, as you see in the attached flowchart. Can you implement this function in your code ? This would be enough for this thread.
translation from italian: iniz=initialization libero av=free space before me av =go straight ostac dx=osbtacle at right ostac sx=obstacle at left dx=right sx=left ost= a label
FL and FL1 = Flags
Leonardo,
My logic is already doing that, look the code:
I put some comments #1-#6
The current logic is:
robot keeps spinning same direction (no oscillation) until the forward sensor is ok, once is ok will enter #1 and drives forward.
Leonardo,
I added some logic to avoid oscillation going left, forward, right, forward, left.
you will need to tweak the value 20 based on your observations, can be higher or low.
relevant lines:
very well,PTP, it's running. I will have only to fine tune some parameter to have a performance approaching the very fast one of pic.
Thank you for having shown me what ezb can do. i'll study your code. Programming that way is different from basic or assembly on pics I was used to. I'll try to get the relevant know-how.
One last detail. I'd like to avoid those annoying windows coming out when you start ezb i.e. mounting instructions, fine tune profile, tutorials for robots I will never have,etc. I have to skip or close them every time.
After this thread I will experiment with servos, actions and frames, and will certainly ask for support in other threads.
I'll be reading you there.
Hi ptp. You're the member who solved ! Now I understand how to use adc reading. To have fast results it's better to use a hardware comparator on board . It can make such operations in 100 nS !.....