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:

if (digital(d2) = true)
if (digital(d3) = true)

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?

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.

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


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

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


$x = getDigital(d0)


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


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

Optionally, you can check for high with...


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

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 :)
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()