-2
私はArduinoの初心者です。ここで私はアナログピンを宣言する問題に直面しています。 A0〜A15の代わりに97〜82のint値を使用できますか?はいの場合はどうですか?メガ2560のアナログピン0-15のデジタル相当品は何ですか?
私はArduinoの初心者です。ここで私はアナログピンを宣言する問題に直面しています。 A0〜A15の代わりに97〜82のint値を使用できますか?はいの場合はどうですか?メガ2560のアナログピン0-15のデジタル相当品は何ですか?
私は、それが正しい範囲ではありませんA15
に代わりA0の97〜82 int型の値を使用できます。 https://github.com/arduino/Arduino/blob/1.8.4/hardware/arduino/avr/variants/mega/pins_arduino.h#L51-L83から:あなたが見ることができるよう
#define PIN_A0 (54)
#define PIN_A1 (55)
#define PIN_A2 (56)
#define PIN_A3 (57)
#define PIN_A4 (58)
#define PIN_A5 (59)
#define PIN_A6 (60)
#define PIN_A7 (61)
#define PIN_A8 (62)
#define PIN_A9 (63)
#define PIN_A10 (64)
#define PIN_A11 (65)
#define PIN_A12 (66)
#define PIN_A13 (67)
#define PIN_A14 (68)
#define PIN_A15 (69)
static const uint8_t A0 = PIN_A0;
static const uint8_t A1 = PIN_A1;
static const uint8_t A2 = PIN_A2;
static const uint8_t A3 = PIN_A3;
static const uint8_t A4 = PIN_A4;
static const uint8_t A5 = PIN_A5;
static const uint8_t A6 = PIN_A6;
static const uint8_t A7 = PIN_A7;
static const uint8_t A8 = PIN_A8;
static const uint8_t A9 = PIN_A9;
static const uint8_t A10 = PIN_A10;
static const uint8_t A11 = PIN_A11;
static const uint8_t A12 = PIN_A12;
static const uint8_t A13 = PIN_A13;
static const uint8_t A14 = PIN_A14;
static const uint8_t A15 = PIN_A15;
ので、A15
通じA0
の値が54
69を通じてあるあなたは、これらの数字の代わりに、A Nピン名を使用することはできますか?はい。
analogRead()でアナログチャネル番号を使用することもできます。例えば 次の3つのステートメントのすべての読み取りピンA0:
analogRead(A0)
と:
analogRead(54)
と:
analogRead(0)
しかし、本当にそれだけであるピン名を使用するように少ない混乱ですあなたのArduinoボードのシルクスクリーンに書かれています。
はいの場合はどうですか?
A nのピン名とまったく同じです。
ここで私はこれを得ました...彼らはA0〜A15の物質として97〜82を示唆しています。このリンクで説明したいことを説明してください... https://www.arduino.cc/en/Hacking/PinMapping2560 –
これは物理的なピン番号です。チップ上の物理ピンの数は、左上から時計回りに1で始まります。彼らはあなたのコードで使用することはできませんし、それらのピンのいくつかはVCCやグランドピンのようなものなので、そうするのは理にかなっていません。 – per1234