0
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?

Xbee3 micropythonを用いた可変抵抗値の取得

Last updated at Posted at 2025-08-25

Xbee3 micropythonを用いた可変抵値の取得

Xbee3 を用いて、アナログ値の入力を受け取ってモニターに表示する操作を行う。

可変抵抗は手元に配線されているものがなかったので照度センサーを用いた分圧回路を代用する。

CdSセル 5mmタイプ: オプトエレクトロニクス 秋月電子通商-電子部品・ネット通販

項目設定

XCTUにて以下の項目を設定する。

D0 を ADC[2] に設定。

AV を VDD Reference[2] に設定。

ところで、xbee3のADC は 12bit みたい。

構成

cds.png

ソース

from machine import ADC
import time

pot = ADC("D0")# TH 20 

while True:
    print(pot.read())
    time.sleep(0.1)

実行結果

>>> Loading /flash/main.mpy...
Running bytecode...
581
583
582
581
578
581
584
580
482
436
391
383
348
358
351
347
339
341

参考文献

Digi Micropython Programming Guide p.80

0
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
0
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?