![]() |
CIM coders help!
Im having trouble programming the CIMcoders. Please correct me if you see something wrong im new at this.
So I have the Encoder plugged into the DIO on the roboRIO. From left to right on the encoder when placed on a motor, I have the 1st pin in DIO 0: 5V, 2nd pin in DIO 1: signal, 3rd pin in DIO 0: GRN, 4th pin in DIO 0: signal. On the code side I am using C++. The Encoder stuff is inside a command and none of it is in the Robot.cpp or the main one. The "DriveCommand" is an Autonmous btw, not sure if that helps. When ever i run it in the FRC Drive Station, I get these errors. Need anymore information fill free to let me know. Thanks Quote:
Code:
#include "DriveCommand.h" |
Re: CIM coders help!
I think you might want to add parentheses to make it look like this:
Code:
victor->Set((CIM->Get() > 5) ? 0 : 1); |
Re: CIM coders help!
Thank you sir i will definitely try that. Thanks for showing an example.
|
Re: CIM coders help!
It looks like you are creating multiple instances of the command which is trying to allocate the same port multiple times. I think you want this to be a Subsystem instead of a command. Have you looked into using RobotBuilder to setup the framework of your code?
https://wpilib.screenstepslive.com/s/4485/m/26402 |
Re: CIM coders help!
In your example you are creating CANTalon objects, so the number in the constructor is actually the CAN ID and not a roboRIO port number. So that in itself should not be a conflict.
Code:
DriveCommand::DriveCommand() {Code:
ERROR -1029 HAL: Resource already allocated, Minimum Value: 0, Maximum Value: 20, Requested Value: 0 PWM [PWM.cpp:43] |
Re: CIM coders help!
I don't think you should try to debug your program until you have the wiring correct. The CIMCoder uses 2 DIO slots on the RoboRio, and needs external pull-up resistors.
Download the spec sheet from AndyMark to verify, but: Orange Pin1 goes to +5V Blue Pin2 goes to Signal0 Black Pin3 goes to GND Yellow Pin4 goes to Signal1 (2) 10K pull-up resistors between +5V and each of the signal wires. |
Re: CIM coders help!
1 Attachment(s)
Quote:
|
Re: CIM coders help!
I am also wondering if you need to use pull up resistor for the CIMCoder. I have used them without and didn't seem to have any issue. But based on the specs for CIMCoder it indicates we would need ~3-4k resistor for 5V supply.
|
| All times are GMT -5. The time now is 21:57. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi