Welcome to Synthiam!

Program robots using technologies created from industry experts. ARC is our free-to-use robot programming software that makes features like vision recognition, navigation and artificial intelligence easy.

Get Started
Asked — Edited

If (Digital) Statement Not Working In Ez Script

Having problem with the if (digital) statement working in the ez script.
Anyone else having that problem, was working before I did the latest version update 9-17-12.

For example:

:menu_1
if (digital(d2) = true)
goto(menu_2)
if (digital(d3) = true)
goto(menu_3)
goto(menu_1)

When I do a check syntax, it finds no errors, and the program will work up until it gets to this point, and then waits for which button is pressed, as it should with this code, but then I can press either of the buttons, and the program does not go any further. Does not go to menu_2 or menu_3 as it did before.

I did check the switches to be sure they are working, and they are.
I even checked the switches through the software "read digital", and it reads "on" when I press the switch.

I even changed the wording from true to on, in the if statement, still nothing, although I hope I don't have to change all the "true" to "on" in the if statements that I have typed.
Not sure what is going on, any help?
Thanks

Ireland
#1  
Yes having similiar problem with " IF " command reading ADC

From my experience of DJ & team this will be resolved shortly, as it has been noted on recent posts since software upgrade.

Pat
PRO
Synthiam
#2  
Beside the script editor is the EZ-Script manual. When using the search option, you will find the GetDigital command.

Quote:


GetDigital( Port )
Displays the Digital value of the specified port
Example: GetDigital(d0)


To see what the GetDigital command returns, use code like this:

Code:


$x = getDigital(d0)

print($x)


So the syntax for an IF condiition with GetDigital will be...

Code:


if (getDigital(d0) = 0)
print("The port is not high")


Optionally, you can check for high with...

Code:


if (getDigital(d0) = 1)
print("The port is high")



:)
#3  
Thanks, but what I am using in my programs is the If (Digital([Port]) [Condition][Value]) statement. The code I have written, one small example is what I had type above. All of the programs that I have written in the ez script, worked before, in the previous versions.
It is not working in this version, I went ahead and downloaded the latest again, v9-18-12, just in case, still does not work.

Not sure what has happened, and what to do. I have written a lot of code, using this If (Digital([Port]) [Condition][Value]) statement, and would hate to have to rewrite all of them.

The EZ-Robot program is perfect for what I need, but without this If (Digital([Port]) [Condition][Value]) statement working, my programs are useless.

Anymore help on this would be appreciated....Thanks :)
PRO
Synthiam
#4  
Please re-read my reply:)

The documented examples were incorrect in the help file. They will be correct in the next version. The command is GetDigital() not Digital()