ライブラリ化を行った後

Dependencies:   QEI accelerator bit_test cyclic_io cyclic_var cylinder event_var limit mbed mecanum motor_drive pid pid_encoder rs422_put sbdbt servo

Fork of 17robo_Practice1 by kusano kiyoshige

Committer:
echo_piyo
Date:
Thu Sep 28 02:25:00 2017 +0000
Revision:
77:17469192b53a
Parent:
66:1664ee92539d
(?)????(?????)????????????????????????????????????????????

Who changed what in which revision?

UserRevisionLine numberNew contents of line
echo_piyo 0:bf96e953cdb8 1 /*
echo_piyo 0:bf96e953cdb8 2 dataのmax,minの範囲内の数値を返す関数
echo_piyo 0:bf96e953cdb8 3
echo_piyo 0:bf96e953cdb8 4 limiti([int]data, [int]max, [int]min); //int用
echo_piyo 0:bf96e953cdb8 5 limitf([float]data, [float]max, [float]min); //float用
echo_piyo 0:bf96e953cdb8 6
echo_piyo 0:bf96e953cdb8 7 */
echo_piyo 0:bf96e953cdb8 8 int limiti(int data, int max, int min){
echo_piyo 0:bf96e953cdb8 9 if (data > max) {
echo_piyo 0:bf96e953cdb8 10 return max;
echo_piyo 0:bf96e953cdb8 11 } else if (data < min) {
echo_piyo 0:bf96e953cdb8 12 return min;
echo_piyo 0:bf96e953cdb8 13 }
echo_piyo 0:bf96e953cdb8 14 return data;
echo_piyo 0:bf96e953cdb8 15 }
echo_piyo 0:bf96e953cdb8 16
echo_piyo 0:bf96e953cdb8 17 float limitf(float data, float max, float min){
echo_piyo 0:bf96e953cdb8 18 if (data > max) {
echo_piyo 0:bf96e953cdb8 19 return max;
echo_piyo 0:bf96e953cdb8 20 } else if (data < min) {
echo_piyo 0:bf96e953cdb8 21 return min;
echo_piyo 0:bf96e953cdb8 22 }
echo_piyo 0:bf96e953cdb8 23 return data;
echo_piyo 0:bf96e953cdb8 24 }