Package frc.team670.pi
Class Motor
java.lang.Object
frc.team670.pi.Motor
public class Motor
extends java.lang.Object
Represents a DC motor which can be controlled with the pi motorshield.
- Author:
- ctychen, lakshbhambhani
-
Constructor Summary
Constructors Constructor Description Motor(int mpinA, int mpinB, com.pi4j.io.gpio.Pin mpinE)
-
Method Summary
Modifier and Type Method Description void
close()
Closes the connection to the motor.com.pi4j.io.gpio.GpioPinDigitalOutput
getPinE()
Returns the E pin for the motorvoid
set(double s)
void
setInverted(boolean inverted)
Sets the motors to run in the opposite direction of its original direction
-
Constructor Details
-
Motor
public Motor(int mpinA, int mpinB, com.pi4j.io.gpio.Pin mpinE)- Parameters:
a
- GPIO pin number of Motor Pin Ab
- GPIO pin number of Motor Pin Be
- GPIO pin (example: RaspiPin.GPIO_06) of digital output
-
-
Method Details
-
set
public void set(double s)- Parameters:
s
- [-1.0, +1.0] with -1.0 being full speed reverse, +1.0 being full speed forward
-
setInverted
public void setInverted(boolean inverted)Sets the motors to run in the opposite direction of its original direction- Parameters:
inverted
-
-
close
public void close()Closes the connection to the motor. Motor has to be reinitialized to be turned on after this. -
getPinE
public com.pi4j.io.gpio.GpioPinDigitalOutput getPinE()Returns the E pin for the motor- Returns:
- GpioDigitalOutput pin E - The E pin controlling the motor
-