Quote:
Originally posted by mjt902
So what you are suggesting this guy do is not put SERIN in the mainloop??
That makes sense and clears me up on a few things. Thaks for the gentle and insightful correction.
|
NO!!!!! If you don't do a SERIN, delta_t will never get updated. Nor will any of your sensors, etc.
All I'm saying is that as long as you don't do a SERIN between the p1_y=150 and the SEROUT, p1_y can be used as a normal variable. For example:
DO
SERIN...
if rc_sw15 = 1 then p2_y=150
if rc_sw16 = 1 then p4_y=150
SEROUT...
LOOP
Until the code reaches the next SERIN, p2_y/p4_y will still have the values 150.
Back to the problem: my guess is that you have the incorrect sensor wire hooked up. You can use either, but your code needs to match. To see if this is the problem, try doing a debug? rc_sw15 right after the SERIN and see if it changes.