Quote:
Originally Posted by NewKid
My team and I have been trying to get the compressor programmed, but it usually clicks when the light is green switching to red for a split second before going back to normal. It does it almost randomly, and does seem to be linked to our code. We have been using a simple on/off trigger so that we can turn the relay on and off, but the clicking happens when the spike should be on. our code is:
When all of the isOn {...} code is commented out, then the clicking does not happen, and it behaves correctly.
Can anyone help?
|
First thing please indent and comment your code.
Indenting code makes it a lot easier to read and look for mistakes especially in next if's , while etc statements.
Also by commenting your code you make it easier for people to see what you mean.
By reading a comment of what you want to do, another person can look at the syntax of your code and see if what you want to do is the same as the code you have written will do.
Off the top of my head I don't know exactly what the mistake is but I would try a few things.
Did you set up a compressor object elsewhere in your code?
Because if you have then this runs in the background and automaticaly turns the compressor on /off.
I think your rel->Set(Relay::kOn); rel->Set(Relay::kOff);
maybe trying to take control from the compressor object.
I would be looking for instances of where the the compressor relay is set on/off. It may be other examples rel-Set() but I think it more likely to be a compressor object.
Hope this helps.