Code two PCM's In Java


#1

Our team is running two PCM’s do to the number of solenoids on the robot this year. We have figured out how to wire them up and understand that we have to change their IDs. But I am struggling on how to go about programming them in. The program is written in Java. If anyone had any ideas of where I could state it would be greatly appreciated, Thanks.
5576 - Programming


#2

Have you tried passing the moduleNumber to your solenoid?

  /**
   * Constructor.
   *
   * @param moduleNumber   The module number of the solenoid module to use.
   * @param forwardChannel The forward channel on the module to control (0..7).
   * @param reverseChannel The reverse channel on the module to control (0..7).
   */
  public DoubleSolenoid(final int moduleNumber, final int forwardChannel, final int reverseChannel)

I believe something like this should work:

DoubleSolenoid solenoidOne = DoubleSolenoid(0, 1, 2) // PCM 0 with channels 1 & 2
// or
Solenoid solenoidTwo = Solenoid(1, 1) // PCM 1 with channel 1

#3

Thank you for your help :slight_smile: I’ll give it a try.


#4

Hopefully that could be also useful

https://wpilib.screenstepslive.com/s/currentCS/m/java/l/599708-operating-pneumatic-cylinders-solenoids