Need help in writing a program to alternate two outputs I am using a PIC Chip with the PicBasic Pro Compiler. What I am trying to do is control two fans with one temp. sensor. When The temp is high one fan comes on and cools everything down that fan turns off.The next time when the temp goes high I need it to start the 2nd fan when that fan turns off the first fan is called again.
If one fan is running and the temp is still rising the second fan comes on. I am having a hard time on the alternating part
THANKS WCE4
Alternating outputs
Re: Alternating outputs
You need to algebratize your problem. What you are doing is driving two outputs from one input which leaves one undefined so you need a memory.
Let F1 be fan 1, and F2 be fan 2.
Let T be the temperature sensor.
Let M be memory<p>Begin
Loop
If M = F1 Then M = F2
If M = F2 Then M = F1<p>If T > x then M ; run M which is either F1 or F2
Goto Loop
End
This will alternate fans.
Add more conditions if you want to run either or both at the same time.
Let F1 be fan 1, and F2 be fan 2.
Let T be the temperature sensor.
Let M be memory<p>Begin
Loop
If M = F1 Then M = F2
If M = F2 Then M = F1<p>If T > x then M ; run M which is either F1 or F2
Goto Loop
End
This will alternate fans.
Add more conditions if you want to run either or both at the same time.
Harold L. Reed
Microbes got brains
Microbes got brains
Re: Alternating outputs
<blockquote><font size="1" face="Verdana, Helvetica, sans-serif">quote:</font><hr>Originally posted by WCE4:
[QB][/QB]<hr></blockquote><p> THANK YOU "IT WORKS"
[QB][/QB]<hr></blockquote><p> THANK YOU "IT WORKS"
Who is online
Users browsing this forum: No registered users and 34 guests