Asked
— Edited
Resolved by Steve G!
i get an error trying to use the ping sensor.something about matrix is not good.
and the text is in nederlands written
bigger pic
The index light outside the matrix boundaries
@nomad.
Can you post the script that has the error so we can have a look.
steve g
i forgot how to do that,
Select the script code, press CTRL and C together to copy it, and paste it on the forum thread inbetween the "Code" tags.
ok i try
ctrl+c and press copie to clipboard? paste is ctrl+v ?
@Nomad Open your script in ARC, highlight it all with your mouse, copy it... then come here and paste it into your post.... done
@Nomad you can also just give us a screen shot of your script...
You can also copy and paste by right clicking on your mouse
@Richard.
I've never been able to copy or paste script to and from ARC using a mouse or trackpad.
@Steve Hmmm, that's weird... You're right... I pretty much use ctrl + C, V, X exclusively so I had never noticed right clicking doesn't work in ARC scripts
@Richard.
Yeah, that's never worked. Well there's your "new thing I Iearned today".
mine doesn copie eather.so here printscreen.
whits i wanne try is the ping make sound i have on pc(sonar) and when he detects some say danger,danger,danger also sound file i have.
Shouldn't there be an "If" and "EndIf" code in there, like "if ping is lower than 50, do or say this"?
i dont know anything about scripting.
@Nomad... Does your ping work and is it attached to ports D22, D21 when you run the script?
rr
yes and i checked the volt regulator too.
I think I'll leave this to Richard as I'm not near a Computer right now.
@nomad.
See what you gone and did... You went and broke the EZ Robot website, lol.
Anyway back to your problem. Try this...
When you start the script the Ping sensor will start detecting distance. Now when the value goes below 50, the EZ-B will say Danger. It will sleep for three seconds and start start detecting distance again.
Hope it helps.
ooops, a bug in Ping_Wait() .. I'll fix it right away
Temporary work around: Use ports between D0 - D21
hi guys
sorry late respons.i couldn get on the forum here.
rr
yes the ping works at port D22 AND D22 but not the script thanks averyone
@nomad... Just after the site went down I remembered there is a bug that DJ knows about... Some ping commands (haven't checked all of them) do not work on ports 23 and 22... As DJ mentioned, you need you use ports 21 or lower...
@nomad.
If my script doesn't work for you (it does work as I tested it) then it maybe what Richard said about using port 22.
okay try other ports
allright it works,just need some volume
thanks you all
@nomad.
Glad you got it sorted. Yeah, having volume when it's trying to speak helps. You don't have to leave the loops in my script, but I prefer to have it in there.
steve g
do i need to ad in the script for more volume
You can setvolume(1xx) higher than 100, but it will begin to distort the higher you go as it will basically be overdrive above 100
EDIT: Richard just posted what I was going to say.
rr
can i set it any where in the script
@nomad set it before the say() command ... try setVolume(200)
ah ok thanks
got it just using 100 .now i need just two things and that is when he 's, not detecting something then play sound file i got whit sonar sound. and second when he detects something stop whit turning. sorta watsh the intruder.
@nomad.
Good to see it working. I won't give you the script to do what you asked, but I'll give you some clues to what you need so you can Give it a try.
If the ping sensor reads over 50, play sonar sound and rotate the servo.
or else if ping sensor reads below 50, stop sonar sound effect and say "danger".
Put in a sleep command.
Go to the start of the script and do the process again.
The clues of what script commands you need are written above. Give it a try and report back.
Good luck.
steve g thats a huge task for me ,give me a couple off months haha just kidding. i like the way you teach.ok let see wht i can find. eek
@nomad.
No problem. Truth be told, I'm not 100% sure how to write the script as im still learning too, but I understand the principles and what's needed...
If over 50, scan and play sonar sound
Elseif under 50, stop scan and sonar sound and say "Danger".
If I had my laptop with me I could probably write the script okay, but I'm away for the weekend so can't give you more than that for now.
rr
steve g gonna like this code
Maybe a better script..
@Richard.
That's a new one for me. I haven't come across that before.
Steve, :Top is a label for the Goto command
Goto will "jump" to the label
A script starts from the top and reads each line downward
When the line reads GOTO(label), then the script will jump to the label. In this case, the label is called TOP. You can name the label anything you want.
You can name the label CHICKEN, if you like chickens. Or you can name it something that identifies what it is for, in which case CHICKEN wouldn't make sense.
Richard used TOP because it's the top of the script. He could have named it anything, but it's nice to name it something that us humans can understand when reading the code back.
For more information, load the GOTO RETURN STACK.EZB project located in Examples\EZ-Script Function Syntax folder
@DJ.
That's cool. I guessed it was a GOTO but didn't realise you could rename, or should I say label it with a custom named. I'll have a look at the examples folder.
Thanks.
Anytime dude
I think my random selection of CHICKEN was due to how hungry I am... oh so hungry. Skipped lunch!
Mmmm. I was thinking pizza myself, lol. Go get something to eat buddy.
so above loop comes chicken?or any name.
@nomad.
From how I understanding now, that's not correct. In your example, :loop doesn't go above :chicken, :loop is :chicken (or :whatever you name it).
Quote from the script manual...
Defines a label for a GOTO() command Example: :My_Label [/quote]
For you guys that are hungry....
Hmmmm, tasty.
@RichardR a little off topic but I've always wondered why you use the impossible statement in a repeatuntil rather than a label/goto loop?
Is the RepeatUntil() what Richard uses to exit a script?
You can exit a script with HALT()
@Rich For obvious reasons I use an impossible statement to have the repeatuntil loop repeat forever... When I first stated using ez robot about a year and a half ago, I did use goto loops instead of repeatuntil... However, it might be just with the ezb3 (because this is what I was using) after a minute or two in a goto loop the ping would fail to fire. With a sleep set at 100 between checks, the ping would just stop working for some reason... I replaced my "read ping goto loops" with a repeatuntil loops and it immediately fixed the ping/firing problem...
To be honest I feel the repeatuntil statement is just a better way to do infinite loops. Goto statements are more meant to jump from place to place in your code...
@nomad.... Try this and let me know if it does what you want... I had to fix my if statement... forgot the brackets...
@nomad... Try this one too... see what works better...
rr goodmorning
danger danger danger is track-4 actully sonar is track-5
it did nothing just lot off heavy noise this is what i want to have.
first ping goes left and right whithout detect any and play sound file (sonar)
then when he spot something stand still and play danger danger danger. when the object leaves he goes back to left and right whit sonar sound.
@nomad... Play with this one to see if you can get it to work the way you want...
rr the previous one stops rotating and disconnects the ezbv4
Which script? What post #?
How long are those sound files 4 and 5 when you play them on their own? 1,2 or more seconds long?
Take out the ControlCommand("Soundboard v4", Stop commands and see if it still disconnects... Make sure you battery is good as well... a weak battery would cause your ezb to disconnect while moving or attempting to move servos...
rr i just try post #55 and post #53 bolt doesn move the servo and disconnect the ezbv4
batt are fully charged
sound files are 4 seconds each. took the command stop out. last little longer but disconnect ezbv4
It works for fine for me albeit I am using different sound files and a fresh battery...
You'll to write your own then because I don't know your set up so that's the best I can do... Like I said... check your battery
One last try... see if this works ... problem will be it will only play track 5 once until it sees an object...
rr
#you may need a sleep command here.i put one in and it doesn disconnect the, ezbv4.ok i will test further.thank you
Ok, work with that one then... the one I just in posted in post #61 probably will work, but it won't play track 5 continually...
@Nomad maybe a possible feature request is to be able to have tracks in the soundboard auto replay so you don't have the call it to play continually in a program repeatuntil or goto loop...... In your case track 5 is only 4 seconds long so having it auto replay would make what you want to do much easier... So this way you start track 5 (ping sound) and it plays over and over until you see an object that is detected with the ping ... Then track 4 plays... When the object is no longer in range your program starts track 5 again...
rr
i jus found it the code do just that.am uploding a video. so one thing to be found is when he spot an object servo must stay , in the direction off the object
Get rid of servo(D3,90) in my code and the ping should point to the object it sees..
dj has fix the bug on port d22 and i downloded the new version. here the video what we have sofar.
Looks like you almost got it working... awesome...
yes now looking to make the servo stop when he detects an object and say. stop surrender now ,got the sound file. gonna make a motion for the ping make a special movement when he detects, the anemy.
i made a video.what i want him to do when he spotted an object. can i wright that in the script next to a soundfile?
@nomad you can add a new line anywhere you want... see below
and it will play soundfile and motionfile same time?
It depends on what you are doing and how you code it...
next to the soundfile danger danger i want that he does the movement like in the last video.same time.
Just code the movement on the next line after track 4 (danger, danger, danger)...