![]() |
Clicking spike relay while on
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:
Quote:
Can anyone help? |
Re: Clicking spike relay while on
the lighting for a spike is as follows:
for a motor: Orange - OFF / Brake Condition (default) Green - Motor rotates in one direction Red - Motor rotates in opposite direction Off - OFF / Brake Condition for a solenoid: Orange - Both Solenoids OFF (default) Green - Solenoid connected to M+ is ON Red - Solenoid connected to M- is ON Off - Both Solenoids ON Basicly when it switches from green to red the spike is reversing the direction. from the code what appears to be happening is that it starts off as isOn = false. Then it enters the first part of the code and isOn changes so now isOn = true. then it looks like the program then goes into the next part of the code and then changes it back to false. Are you sure that you are not looping it because the first time it would go through it would do the first half of the code and the next time through it would switchback. |
Re: Clicking spike relay while on
no, it is programmed right, and it goes orange not red (my mistake), but it clicks back and forth, almost too fast too see, just a split second switch when it is only programmed to be on
|
Re: Clicking spike relay while on
Quote:
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. |
| All times are GMT -5. The time now is 02:25. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi