|
More Analog Inputs
Hi, so our team has decided to use your typical MaxBotics analog rangefinders (ultrasonic sensors), plugged into the code as general analog inputs. Now, this part works just fine, but there is one major issue: whenever the robot is supplying power to the motors, the sensor malfunctions.
The robot drive is constructed on ports 0-3, but those are outputs to the motor. On the rio itself, none of the analog input ports are in use (except for the ultrasonic sensor on port 0). For whatever reason, when power is outputted to the motor on ouput 0, our sensor on input 0 starts acting up (it reads a consistent value no matter what power the motor is on).
There are two parts to my inquiry.
Firstly, when we plug in encoders (essentially analog sensors) into the analog inputs, they don't have any issues with reading incorrectly when the motors are running. This only happens with the ultrasonic sensor. Frankly, we have no idea why. If anyone can offer any insight/fixes, please let us know; I've been working on this for days.
Secondly, if it is impossible to prevent the ports getting some weird form of interference from the drive, how can I get the rio to read from a different port? I understand that there are references; I don't understand what they're saying, and a lot of them have conflicting instructions.
In terms of that latter one, I'd like to know if you use a breakout board, how do ports work? Do I just put in port 5 in the code? Or do I have to specify in the constructor that it's reading from port 5 on the breakout board? I've seen that you can read analog sensors from a Talon SRX, then get that signal to a CAN bus, then get the CAN bus to go to the rio. In this case, do i instantiate an analog input, or a CAN object? If it is the former, what do I put for the port, since port 0 on a CAN bus would be different from port 0 on the analog ports? If it is the latter, then how do I get the analog value from it? Please send any help that you can.
Thank you.
|