Now THAT is the type of question I like to see...please no smoke wrote:How do you set a user led in brains??
Reading, Setting and Resetting a UserLED in a Brain
As the title suggests, this example shows you how to read, set or reset a UserLED in a Brain. The standard Brains disclaimer applies: If you assign a value to I/O, LED, variable etc... in a Brain, it can only be assigned once if you expect to use it reliably. That's once as in only on this line, in this Brain. It can't reliably be assigned a value again either in the same Brain, or in another Brain or Macro. See this write up for information: Brains Vs. Macros – How To Decide
For more detailed information on Brains programming in Mach, please see http://www.machsupport.com.
In the Brain below, we are in the process of writing logic that will assigning a value to UserLED #1000 based on the state of Ajax input #1 (Modbus input 1, bit only). UserLED's are assigned a number of from 1000-2255. To read or assign a value to an UserLED you must check the box “Use LED number” and then type a value of between 1000-2255 to specify which UserLED you wish to use.
NOTE: When using a UserLED in a Brain, the Brain editor may label it as an “OEMLED). The label is incorrect as, by definition, LED's 1000 and above are user LED's. The label assigned in the editor is irrelevant, simply refer to the LED by it's number to read, set or reset it.
When finished, this Brain will reset UserLED #1000 (assign a value of 0) if Ajax input #1 is open, and it will set UserLED#1000 (assign a value of 1) if Ajax input #1 is closed. Please note that the single line of code sets the LED when true and resets when false.