kamaroman68
USA
Asked
— Edited
Very simple logic, just don't know the commands in ARC... Just added a maxbotics analog distance sensor. It works in ARC. What I would like is when the distance is equal to or less than 50 speak out the ezb. I set up an analog port and I'm trying to use the adc wait command, from there? Thanks Chris
It does help to provide existing code that you have written so we can help build off of it. Could you paste your current code please? Thanks!
All I have so far is adc_wait(adc7,lower,50)
Im not sure how to add an if command say something out ezb speaker.
OK so I tried again.... how do I copy and paste what ive done? My code is this...
IF(ADC7,lower,50) SayEZB " I have detected something in my path " EndIf
It comes up with an error on line 1. Says missing quotes or invalid expression.
Your syntax is incorrect... The code doesn't make sense , but it should run... The if statement is redundant... meaning the if statement isn't needed because the code will continue only if the ADC_Wait returns above 50 ...
This is all you really need....
I agree with you to a certain extent... as we move closer to the sensor the number goes down not up. So what I am looking for is when something is detected closer. But I think I can modify what you did as an example. I will try , and then post back. Thanks Richard R
So modify it then...
Sorry Richard R , not working. I need to make sure i'm doing it right though. I just pulled out a script control and scripted inside it.
Is there a way to make it loop? To make it work I have to sit and push start script. I would like to have it sense an object and say it automatically, not just once. If I walk in front of the robot I want to say it, then when I get out of its path , and return to its path say it again. I will build upon this with eventually stopping the robot.
Does it give an error?.... the code works for me
it works only when I push the start script button for me. The script runs only once.
Check my syntax as I am doing this from memory.. you need to check what values the sensor is feeding back before you can use it in a script...
I changed the code above to repeat forever so you can use it to see what values the sensor is continuing to put out...
Once you figure out what the sensor is reading and value you need you can then modify the code to actually use in your project...
Hey Richard the above code does run forever like you said. But when I add an If statement ($x) < 50) I get an error, Something about nesting. Ive had enough for tonight. Thanks for your help
Hey Kamaroman68 sorry to disturb but the reason why your getting an error message about nesting is because ($x)<50) is because you only have one pair of parentheses and a leftover one. When they say "nesting" they're saying your parentheses do not match up. I 'll give an example: (5+(3+2) if this was in a code I would get a nesting error because my parenthesis don't match up. I suggest reviewing Richard's previous example.
This code should work... again, check my syntax before running....
This simpler version should work too...
Simply use a repeatwhile(1 > 0) for a forever loop
So;
You can click the stop button or run a ControlCommand to stop a script so there's no need for an escape variable.
Or, if you wanted the value displayed;
In the above example you could replace the repeat with a simple :label and Goto()
OK so my saga continues..... at first all I wanted was to speak when an object was detected in its path. But after thinking about this, and already having the movement of the robot scripting in place (sort of) I would like to add to the complications. I looked at Rich's Ping roam script on the cloud but it didn't help much. What I have is one controller ezb4 in the robots head and one down at the drive base. The head board will need to interact with the base board as the head sensors are being used to determine distance to object. So..... I would like the robot to move on voice command, when approaching an object in path stop, say "I have detected an object in my path" Sleep(1000) then ask if it should proceed moving. An answer of yes will allow it to proceed while an answer of no well that's obvious... Any help is appreciated... Chris
That's pretty simple. Do you want to be spoon fed or do you want the menu?
When using 2 boards you will need to tell the script commands which board to use (where applicable). This is denoted by the board number before the port i.e. Servo(0.D0, 60) or Servo(1.D0, 60)
The scripts provided so far should be a good base. but change the commands within the IF or after the ADC_Wait.
You want to use WaitForSpeech()
and an IF to determine what to do. Check both out in the script manual.