If I change the declaration to "bool spindleFaultEnunciated = false;" or true, I don't get an error, but it messes up what I'm trying to do. I want to Add the status message just one time... not every time the loop cycles.
I know this is really basic and I'm doing something foolish. I promise to smack myself in the head when you point out my mistake.
- Code: Select all
// Macro execution starts here
bool spindleFaultEnunciated;
if (AS3.GetLED(349)) //Modbus Word 3, Bit 1, Spindle Fault from PLC
{
if (spindleFaultEnunciated == false)
{
exec.AddStatusmessage("Main Spindle VFD Fault");
spindleFaultEnunciated = true;
}
}
else
{
spindleFaultEnunciated = false;
}
If I try to declare it in line with "If (bool spindleFaultEnunciated == false)", then I get this mess of errors.
CS1525 | in line: 36 | error text: Invalid expression term 'bool'
CS1002 | in line: 36 | error text: ; expected
CS1525 | in line: 36 | error text: Invalid expression term ')'
CS1002 | in line: 36 | error text: ; expected