![]() |
Help with automatic relay control
Forgive me if this is answered somewhere else -- I looked and could not find.
I am trying to get a relay to automatically fire forward when the analog values to a pwm are in a range around nutral. I put an if statement in with an assignment specifying the condition I want and it works, but will not change states when when the joystick is moved out of the range. I tried adding an else if statement after, I tried a while loop, no good??? Any suggestions -- I know it is something simple I am missing. |
Re: Help with automatic relay control
If you post your code, we can tell you what the problem is. If I understand what you are trying to do correctly, it should look a little like this:
Code:
if (pwm_val > (127 + deadband) || pwm_val < (127 - deadband)) |
Re: Help with automatic relay control
That is the first thing I tried, but the relay will not change from the first state it goes to.
I will try to post some code when I get to that computer. It is done in easyc though -- I might just try to put in some user code. Thanks |
Re: Help with automatic relay control
EasyC also visualizes as straight C code so you can post that. It could also be that your joy sticks are out of trim and moving them is not taking them out of your deadband.
|
Re: Help with automatic relay control
I thought that also, so I did a print to screen and they show the value change.
|
Re: Help with automatic relay control
Dan,
Thanks for the help. I got it working. I do not know what was wrong, but I redid it ( replaced || with && ) and it works great. By the way -- this is for an automatic brake ( using a bicycle disk brake acuated pnumatically ) for our arm. I think it will work great now. Thanks !!!! |
| All times are GMT -5. The time now is 23:11. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi