We’re having a sirious problem with the IR:
We’re wiring the wires of the colorful cable thingy to PWM pins, and we’re connecting them to the RC to the digital in/out pins.
When we’re connecting the PWMs to the digital in/out pins the ERORR light on the IR turns on and we’re not able to use the IR.
I presume we’re just not sure how to wire the wires of the colorful cable, but we haven’t found any guides, except for one Edena Robotic’s one on Youtube.
You should connect the IR board’s output into the Digital I/O, and in your robot code, have a section for interpreting the signal, maybe something like what is shown below if your output is connected to Digital I/O #1.
printf("Button one is pressed on IR
I don’t know if this is because we tried on a vex controller, but when we set up the IR sensor, everything was inverted. So we got +voltage out of every pwm when there was no button press, and then when there was a button press, we had every input but the needed one drop in voltage to 0. I am startng to think that we have it miswired, but this is what the pwms look like (1 = +voltage, 0 = 0 voltage)
The only thing about this is that you cant just go “If(digin1 == 1)” because they default to 1!! We just use a bunch of ands and checked for the pattern, but it seems odd that nobody else is reporting this. What is the way to properly wire it? Or do we have it the correct way?
I was wondering, do you power the IR senor with the backup battery through the pwm outputs, or you have to wire them directly onto the E board with like a 20amp fuse. Also do you need to supply power to both positives and negatives or just one set of them to use the sensor?
i believe it can be done both ways and you only need to power one + and one - pin on the IR board. If you look closely on the back, pin 1 and 2 (and 3 and 4) are connected so it doesn’t matter which one you use
I think you will need to power the IR board via the 12V distribution panel. I believe the PWM outputs are 5V. The IR board needs at least 7 Volts in order to work properly, hence wiring to the 12V panel. I would recommend a very small fuse, like 1 amp.
if (rc_dig_in14) //no jumper
ir_cmd = CMD0;
else if (rc_dig_in04)
ir_cmd = CMD1;
else if (rc_dig_in05)
ir_cmd = CMD2;
else if (rc_dig_in06)
ir_cmd = CMD3;
case CMD0: //Forward
pwm02 = (unsigned char) 254;
pwm03 = (unsigned char) 50; //Adjusted for Faster Motor
case CMD1: //Turn Right
pwm02 = 0 + RT_SPEED_ADJ - 20; //Adjusted for slower motor
pwm03 = 0 + RT_SPEED_ADJ;
case CMD2: //Turn Left
pwm02 = 254 - LT_SPEED_ADJ;
pwm03 = 254 - LT_SPEED_ADJ;
case CMD3: //Stop
pwm02 = 127;
pwm03 = 127;
I have each of the appropriate rainbow cable wires going to the signal pin (white) and I daisy chained the grounds (black) with pins 3 and 4 from the rainbow cable.
I have a toggle sw to control the power to the IR unit, so if the Vex Power in on, then I switch on the IR unit, I get initial 1’s then zeroes. If I already have the IR power on, then power on the Vex, I get zeroes from the beginning.
Problem solved: IR gone nuts and wiring was wrong.
Next IR will come in next week but we’ll be able to work with it by then. Currently we’re alterning switches as IRs (seeing how the code reacts with switches on and off etc.)