SPIKE-RT C API Reference [Japanese]
An RTOS-based software platform for LEGO® Education SPIKE™.
|
API for motors [詳解]
#include <pbio/port.h>
#include <pbio/servo.h>
型定義 | |
typedef pbio_servo_t | pup_motor_t |
列挙型 | |
enum | pup_direction_t { PUP_DIRECTION_CLOCKWISE = PBIO_DIRECTION_CLOCKWISE , PUP_DIRECTION_COUNTERCLOCKWISE = PBIO_DIRECTION_COUNTERCLOCKWISE } |
関数 | |
pup_motor_t * | pup_motor_get_device (pbio_port_id_t port) |
ポートIDで指定されたモータへのPUPモータデバイスポインタを取得する. [詳解] | |
pbio_error_t | pup_motor_setup (pup_motor_t *motor, pup_direction_t positive_direction, bool reset_count) |
モータを初期化する. [詳解] | |
pbio_error_t | pup_motor_reset_count (pup_motor_t *motor) |
エンコーダをリセットする. [詳解] | |
int32_t | pup_motor_get_count (pup_motor_t *motor) |
エンコーダの値を取得する. [詳解] | |
int32_t | pup_motor_get_speed (pup_motor_t *motor) |
モータの回転速度を取得する. [詳解] | |
pbio_error_t | pup_motor_set_speed (pup_motor_t *motor, int speed) |
モータの回転速度を設定する. [詳解] | |
int32_t | pup_motor_get_power (pup_motor_t *motor) |
モータのパワー値を取得する. [詳解] | |
pbio_error_t | pup_motor_set_power (pup_motor_t *motor, int power) |
モータのパワー値を設定する. [詳解] | |
pbio_error_t | pup_motor_stop (pup_motor_t *motor) |
モータを止める. [詳解] | |
pbio_error_t | pup_motor_brake (pup_motor_t *motor) |
ブレーキをかけてモータを止める. [詳解] | |
pbio_error_t | pup_motor_hold (pup_motor_t *motor) |
モータを止めて角度を維持する. [詳解] | |
bool | pup_motor_is_stalled (pup_motor_t *motor) |
モータがストールしているか調べる. \detail モータを動かす前にpup_motor_set_duty_limitを呼んで最大トルクを下げておくと感度を調整することができる. [詳解] | |
int32_t | pup_motor_set_duty_limit (pup_motor_t *motor, int duty_limit) |
モータのデューティ値を下げる. \detail 元の状態に戻すにはこの関数の戻り値を使ってpup_motor_restore_duty_limitを呼ぶ.. [詳解] | |
void | pup_motor_restore_duty_limit (pup_motor_t *motor, int old_value) |
モータのデューティ値を元に戻す.. [詳解] | |
API for motors