![]() |
Getting the relays to stay constant
Right now we have our pump hooked up to one of the spikes on #5 and while it works (press a button and it goes on) it doesn't stay on and it's really annoying to have to hold it down.
I think* (i don't know how to code and no one on the team does) that all I have to do is something like this when joystick button is depressed set a variable equal to one then do an if statement, if variable equals 1 to set the relay to fwd, else if, set relay to neutral position i guess fwd and rev are equal to zero? I don't know the proper syntax or way about doing this, but i think it would only be a 1 or 2 lines of code could anyone tell me how to do it or write it out so I could just copy and paste it into our code? plzzzz It's #5 if you want to write it out |
Re: Getting the relays to stay constant
Do something like this:
Code:
unsigned char state = 0; |
Re: Getting the relays to stay constant
Quote:
relay8rev = !digitalinput18; those names area ll wrong because I dont have code with me, but what it does is set the relay to the opposite value of the digital input sensor (in this case, the preasure switch). If the swith is 1 (it's up to preasure) the relay is off. If it's below presure (0), then the relay will fire up (to 1). Hope you can learn something from this. ~Bstempi |
| All times are GMT -5. The time now is 16:10. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi