/** * Free the speed controllers if they were allocated locally */ public void free() { if (m_allocatedSpeedControllers) { if (m_frontLeftMotor != null) { ((PWM) m_frontLeftMotor).free(); } if (m_frontRightMotor != null) { ((PWM) m_frontRightMotor).free(); } if (m_middleLeftMotor != null) { ((PWM) m_middleLeftMotor).free(); } if (m_middleRightMotor != null) { ((PWM) m_middleRightMotor).free(); } if (m_rearLeftMotor != null) { ((PWM) m_rearLeftMotor).free(); } if (m_rearRightMotor != null) { ((PWM) m_rearRightMotor).free(); } } }
/** * Free the speed controllers if they were allocated locally */ public void free() { if (m_allocatedSpeedControllers) { if (m_frontLeftMotor != null) { ((PWM) m_frontLeftMotor).free(); } if (m_frontRightMotor != null) { ((PWM) m_frontRightMotor).free(); } if (m_rearLeftMotor != null) { ((PWM) m_rearLeftMotor).free(); } if (m_rearRightMotor != null) { ((PWM) m_rearRightMotor).free(); } } }
/** * Create RGB LED with 3 PWM ports * * @param redPort PWM port for Red LED * @param greenPort PWM port for Green LED * @param bluePort PWM port for Blue LED */ public RgbLED(int redPort, int greenPort, int bluePort) { red = new PWM(redPort); green = new PWM(greenPort); blue = new PWM(bluePort); set(0, 0, 0); }
/** * Create LED with PWM port */ public PWMLED(int port) { output = new PWM(port); set(0); }
public short getSpeedAsShort() { return (short) ((PWM) (controller)).getRaw(); }
@Override public void destroy() { if (controller instanceof PWM) { ((PWM) controller).free(); } }
public LED(int port) { _led = new PWM(port); }
/** * Instantiates an LED. * * @param moduleNum digital module number * @param channel channel LED is attached to * @param name name of LED */ public GRTLed(int moduleNum, int channel, String name) { led = new PWM(moduleNum, channel); led.setRaw(brightness); }
/** * Instantiates an LED on the default digital module. * * @param channel channel LED is attached to * @param name name of LED */ public GRTLed(int channel, String name) { led = new PWM(channel); led.setRaw(brightness); }