motor.java

来自「单片机上的java虚拟机 用winavr 编译」· Java 代码 · 共 44 行

JAVA
44
字号
package nanovm.nibo.drivers;/** * Provides methods for the motor controll. All speed information has to be * given in ticks, a tick is 1/20 of a whole rotation. * see <a href="http://nibo.editthis.info/wiki/Motorcontroller-Firmware">Nibo Wiki</a> for details. * @author Nils Springob */public class Motor {  public static final int MAXIMUM_PWM = 1024;  public static final int MINIMUM_PWM = -1024;  public static final int MAXIMUM_SPEED = 200;  public static final int MINIMUM_SPEED = -200;  /**   * Set the parameters for the motor control algorithm.   * @param p proportional factor   * @param i integral factor   * @param d differential factor   */  public static native void setParameters(int p, int i, int d);    /**   * Bypass the motor controller and set the PWM values directly.   * @param left pwm value for the left motor   * @param right pwm value for the right motor   */  public static native void setPWM(int left, int right);    /**   * Set the target speed for the motor controller.   * @param left target speed for the left motor in ticks per second   * @param right target speed for the right motor in ticks per second   */  public static native void setSpeed(int left, int right);  /**   * Stop all motor activity immediatly.   */  public static native void stop();  }

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?