Class HoverboardWheel

java.lang.Object
me.autobot.lib.robot.Device
me.autobot.lib.robot.Motor
me.autobot.lib.robot.motors.HoverboardWheel
All Implemented Interfaces:
Logger

public class HoverboardWheel extends Motor
A hoverboard wheel motor.
  • Constructor Details

    • HoverboardWheel

      public HoverboardWheel(int identifier, int address)
      Creates a new HoverboardWheel with the given I2C address (and default I2C bus).
      Parameters:
      identifier - The identifier of the motor.
      address - The address of the motor.
    • HoverboardWheel

      public HoverboardWheel(int identifier, int address, int bus)
      Creates a new HoverboardWheel with the given I2C address and bus.
      Parameters:
      identifier - The identifier of the motor.
      address - The address of the motor.
      bus - The bus of the motor.
  • Method Details

    • connectToSerial

      public void connectToSerial(String port)
      Do not use this method, use the one with the directionPin and speedPin instead.
      Overrides:
      connectToSerial in class Motor
      Parameters:
      port - The port to connect to.
    • connectToSerial

      public void connectToSerial(String port, int directionPin, int speedPin)
      Connects the motor to the serial port.
      Parameters:
      port - The port to connect to. Example: "/dev/cu.wchusbserial.10"
      directionPin - The pin to use for the direction.
      speedPin - The pin to use for the speed.
    • setSpeed

      public void setSpeed(double speed)
      Sets the speed of the motor.
      Overrides:
      setSpeed in class Motor
      Parameters:
      speed - The speed of the motor.
    • reportSpeed

      protected void reportSpeed()
      Reports the speed of the motor to the connection.
      Overrides:
      reportSpeed in class Motor
    • writeToPWMPin

      protected void writeToPWMPin(int index, float value)
      Writes a float to a specific pin.
      Parameters:
      index - The index of the pin to write to.
      value - The float to write to the pin.
    • writeToPWMPin

      protected void writeToPWMPin(int index, byte[] value)
      Writes a byte list to a specific pin. Should be 4 bytes long (a float!)
      Parameters:
      index - The index of the pin to write to.
      value - The byte list (length=4) to write to the pin.
    • setMaxSpeed

      public void setMaxSpeed(double maxSpeed)
      Sets the maximum speed of the motor.
      Parameters:
      maxSpeed - The maximum speed of the motor.