代码无法为 WeMos D1 编译,但适用于 Arduino Uno



代码不会为WeMos D1编译,但对Arduino Uno工作正常。

我收到错误

error: 'A1' was not declared in this scope
#include "HX711.h"
HX711 scale(A1, A0);// parameter "gain" is ommited; the default value 128 is used by the library
void setup() {
    Serial.begin(9600);//2280
    scale.set_scale(1810.f); //// this value is obtained by calibrating the scale with known weights
    scale.tare();
}
void loop() {
    Serial.print("n");
    Serial.print(scale.get_units(), 1);
    scale.power_down(); // put the ADC in sleep mode
    delay(500);
    scale.power_up();
}

来自 ESP8266 Arduino 存储库的参考文档:

ESP8266为用户提供单个ADC通道。可以使用读取 ADC 引脚上的电压,或读取模块电源电压(VCC(。

要读取施加到ADC引脚的外部电压,请使用analogRead(A0(。输入电压范围为 0 — 1.0V。

所以 A1 也没有定义。

最新更新