Quote:
|
Originally Posted by KenWittlief
Im more lost than you are - a digital input should only be able to give a value of 1 or 0
I have no idea how you are getting 256 or all those other values from a single bit pin
try searching your code on the variable names - maybe there is a stray equation someplace that is setting the bit variables to something else?
this is really strange.
|
the input you he's getting on rc_dig_in01 is actually 0 and 1, but it's being printf'd without being cast to an int - thus, the unsigned char value is being taken along with a second byte of padding, thus 0 + 256 = 256, and 1 + 256 = 257.
2Crisis, when you printf values, make sure you do it like this:
Code:
printf("dig in 1: %d", (int) rc_dig_in01);
make sure you have the banners wired correctly - the blue and brown wires for both sensors should be hooked up to a 20 amp fuse on your fuse panel, and
either the white
or the black wire (the same color for both sensors) should be hooked up to the SIG pin of the digital input port.