2017-04-11 37 views
0

代碼不會爲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(); 
} 
+1

ESP8266只有一個模擬引腳,不能用作數字引腳。下面的答案 –

+0

將被標記爲分辨率。 – cagdas

回答

0

reference doc of the ESP8266 Arduino repo

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

要讀取施加到ADC引腳的外部電壓,請使用analogRead(A0)。輸入 電壓範圍爲0 - 1.0V。

所以A1也沒有定義好。