HappyHippo Posted December 23, 2008 Share Posted December 23, 2008 I just got a U12 and I'm experimenting with it. Right now I want to turn off and on a relay based on a voltage. The voltage is read from channel 8 - analog (differential) The output is read from channel 4 - digital (db-25) I wrote the following sequence: while (1) if (bat01 > 1) r01 = 1 else r01 = 0 endif delay(1) endwhile My problem is that the value of r01 keeps changing from 0 to 1 even though bat01 is always > 0. Thus, the circuit that the relay is controlling is going off and on. What am I doing wrong? I've tried a lot of variations of the code above with the same results. I'm probably doing something so stupid that I can't see it. Any help would be appreciated. Link to comment Share on other sites More sharing options...
This topic is now archived and is closed to further replies.