![]() |
Solenoid control
I am trying to program the solenoids this year to wherewhen i hold the trigger it activates and when i let go it deactivates. Same as the reverse motion. I wrote this code to do this but it wont work. When i press the trigger the solonoid activates but when i let go it doesnt stop. And it WILL NOT go back when i press the rev button. heres the code i wrote :
Code:
if (p3_sw_trig); |
Re: Solenoid control
Quote:
Code:
if (p3_sw_trig) Code:
relay3_fwd=p3_sw_trig?1:0;<edit> Hm... now that I think about it, you might even be able to do: Code:
relay3_fwd=p3_sw_trig;</edit> |
Re: Solenoid control
Here is the way to do this:
if (p3_sw_trig) //no semi colons for functions { relay3_fwd = 1; } else (!p3_sw_trig) { relay3_fwd = 0; } else if (p3_sw_top) //or if is fine here also { relay3_rev = 1; } else { relay3_rev = 0; } |
Re: Solenoid control
[quote] Two, your last if statement checks !p3_sw_trig instead of !p3_sw_topQUOTE]
o yea that isnt the problem because i didnt put that there i kinda just that laswt bit of code from memory. but the semicolon would explainthe syntax errors . Ok im gonna try your code and hope it works. Thanks! |
Re: Solenoid control
where in the user_routines.c would i put this code? or is there a diiferent file where this code would belong?
|
| All times are GMT -5. The time now is 23:57. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi