簡體   English   中英

代碼不會為 WeMos D1 編譯,但適用於 Arduino Uno

[英]Code won't compile for WeMos D1 but works fine for 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 repo 的參考文檔

ESP8266 有一個可供用戶使用的 ADC 通道。 它可用於讀取 ADC 引腳上的電壓,或讀取模塊電源電壓 (VCC)。

要讀取施加到 ADC 引腳的外部電壓,請使用模擬讀取 (A0)。 輸入電壓范圍為 0 — 1.0V。

所以 A1 也沒有定義。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM