Quote:
Originally Posted by Mr. Lim
Something like the above will give you two independent variables representing the lights that you can change without knowing the state of the other light. Just call updateLights periodically.
|
The above is essentially what I
posted previously in this thread:
Quote:
|
One way to do this would be to have each process just set a boolean flag to indicate whether its LED should be ON or OFF, and let a third process set the proper state of the Spike
|
..except for the suggestion of calling the relay update task periodically.
The problem with calling the update task periodically is that in order to get good flashing "fidelity" it must be called at a fast rate even if the flashing rate of the individual LEDs is quite slow, and this wastes resources.
The fidelity of flashing LEDs is probably not critical but what if it were something which was critical? How should that be coded? You can put the Relay Update code in a separate thread and have it wait for notification that the LED states have changed, and then it updates the relay immediately and waits for another LED state change.