Kouki Suzuki / IRsensor

Dependents:   IRsensor_sample 2019NHK_A_sensor 200_yotsuba_21

Embed: (wiki syntax)

« Back to documentation index

IRsensor Class Reference

IRsensor Class Reference

SHARP 2Y0A21を使ったIR距離測定のクラス More...

#include <IRsensor.h>

Public Member Functions

 IRsensor (PinName pin)
 コンストラクタ
float getVoltage ()
 センサの値を取得
float getDistance ()
 センサの値を距離変換し取得
void startAveraging (uint8_t averaging_range)
 距離の平均化設定
float get_Averagingdistance ()
 平均化した距離を取得

Detailed Description

SHARP 2Y0A21を使ったIR距離測定のクラス

Definition at line 35 of file IRsensor.h.


Constructor & Destructor Documentation

IRsensor ( PinName  pin )

コンストラクタ

Parameters:
pinPint that can do analogin

Definition at line 3 of file IRsensor.cpp.


Member Function Documentation

float get_Averagingdistance (  )

平均化した距離を取得

Returns:
distance_average

Definition at line 85 of file IRsensor.cpp.

float getDistance (  )

センサの値を距離変換し取得

Returns:
originaldistance

Definition at line 81 of file IRsensor.cpp.

float getVoltage (  )

センサの値を取得

Returns:
voltage

Definition at line 90 of file IRsensor.cpp.

void startAveraging ( uint8_t  averaging_range )

距離の平均化設定

Parameters:
averaging_rangeaveraging range 1~255

Definition at line 60 of file IRsensor.cpp.