1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

[ふたたび]赤外線距離センサーGP2Y0A21YKで遊ぶ。(4)(6cm、7cm、8cm

Last updated at Posted at 2025-07-17

参考(浮動小数点数で計算)

いろいろ注意

  • 過去ログをみよ
  • arduinoでの予定は、未定
  • あまり、正確では、ない

いろいろ計算

  • 1で割る距離を求める

o_coq918.jpg

1 / 0.1 = 10cm
1 / 0.125 = 8cm
1 / 0.142 = 7cm
1 / 0.166 = 6cm

  • グラフをお絵描きソフトに読み取って座標を計算する

o_coq919.jpg

=== 8cm ===

86 - 47 = 40

67 - 47 = 20
86 - 67 = 20

20 / 40 = 0.5 (50%)

3 - 2.5 = 0.5

0.5 * 0.5 = 0.25
2.5 + 0.25 = 2.75V

=== 7cm ===

86 - 46 = 40

47 - 46 = 1
86 - 47 = 39

39 / 40 = 0.975

3 - 2.5 = 0.5

0.5 * 0.975 = 0.48
2.5 + 0.48 = 2.98V

=== 6cm ===

46 - 6 = 40

36 - 6 = 30
46 - 36 = 10

10 / 40 = 0.25 (25%)

3.5 - 3 = 0.5

0.5 * 0.25 = 0.12
3 + 0.12 = 3.12V

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?