Пример #1
0
  /**
   * Construct an analog output on a specified MXP channel.
   *
   * @param channel The channel number to represent.
   */
  public AnalogOutput(final int channel) {
    m_channel = channel;

    if (!AnalogJNI.checkAnalogOutputChannel(channel)) {
      throw new AllocationException(
          "Analog output channel " + m_channel + " cannot be allocated. Channel is not present.");
    }
    try {
      channels.allocate(channel);
    } catch (CheckedAllocationException e) {
      throw new AllocationException("Analog output channel " + m_channel + " is already allocated");
    }

    long port_pointer = AnalogJNI.getPort((byte) channel);
    m_port = AnalogJNI.initializeAnalogOutputPort(port_pointer);

    LiveWindow.addSensor("AnalogOutput", channel, this);
    UsageReporting.report(tResourceType.kResourceType_AnalogOutput, channel);
  }
Пример #2
0
 public double getVoltage() {
   return AnalogJNI.getAnalogOutput(m_port);
 }
Пример #3
0
 public void setVoltage(double voltage) {
   AnalogJNI.setAnalogOutput(m_port, voltage);
 }