Asked — Edited

Help With Script Again

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


ARC Pro

Upgrade to ARC Pro

Unleash your creativity with the power of easy robot programming using Synthiam ARC Pro

PRO
Synthiam
#1  

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!

#2  

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.

#3  

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.

                                       Thanks   Chris
#4  

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 ...


ADC_Wait(ADC7, HIGHER, 50)

$x=getadc(adc7)
IF($x>50)
SayEZB (" I have detected something in my path ")
EndIf


#5  

This is all you really need....



ADC_Wait(ADC7, HIGHER, 50) #the script stops here until the value exceeds 50

SayEZB (" I have detected something in my path ")


#6  

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

#7  

So modify it then...


ADC_Wait(ADC7, Lower, 50) #value lower than 50 or whatever value you want

SayEZB (" I have detected something in my path ")


#8  

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.