Welcome, Guest. Please login or register.
Did you miss your activation email?
September 24, 2017, 10:53:30 AM

Login with username, password and session length
Search:     Advanced search
* Home Help Search Calendar Links Login Register
+  Machsupport Forum
|-+  Mach Discussion
| |-+  Brains Development
| | |-+  compare input1 (switch) to "1" or "0" no worky ...because BOOLEAN?
Pages: 1   Go Down
Print
Author Topic: compare input1 (switch) to "1" or "0" no worky ...because BOOLEAN?  (Read 353 times)
0 Members and 1 Guest are viewing this topic.
damo green
Active Member

Offline Offline

Posts: 16


View Profile
« on: September 01, 2017, 10:01:34 PM »

 | INPUT#1    0/:1  | -------| COMPARE =1 |               when I toggle the physical switch, I can watch the brain and see the input rung color & value toggle accordingly between 0 & 1 , bu the COMPARE rung will never toggle  even though the input matches "1"

I also tried  with | COMPARE >0|  , also does not work, just like above. I suspect it is because it is boolean  and 1/0 does not  represent true/false  exactly ?...but can not input "true" into the compare field…
---------
I found a workaround by comparing and LED set to "1" to the input and that did work…..which was a workaround in itself because trying to set an Input to be a local variable causes  Mach3 to hang…..


Would like to be able to write the brain without having to edit a screenset and set an led to "1" as a crazy workaround...
Logged
GrandpaXYZ
Holding

Offline Offline

Posts: 2


View Profile
« Reply #1 on: September 03, 2017, 02:54:18 PM »

I think you're using the wrong compare 'function'.

-If you want to pass the value of a single switch directly you simply use 'no operation' instead of 'compare'. (Or no operation -> invert)

-If you want to 'compare' two inputs then you use one line per input. On each line you add 'no operation' right after your 'input' (same as above). DO NOT TERMINATE ANY LINE. The 'trick' is that you then select (click) both 'no operation' boxes  (both will be green) and then hit the '+' button.  TaDa!!! You will then see a popup where you can choose 'compare a b' or use boolean logic (and, or ,eor...)

Logged
Pages: 1   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.20 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!