Wemos D1 端口引脚对应的digital数值,,Wemos D1控制led引脚号

WeMos中定义的arduino引擎编号其实是与ESP8266上的GPIO引擎编号对应.即:
    16=D2;
    14 = D5/D13;
    12 = D6/D12;
    13 = D7/D11;
    15 = D10;
    2 = D9;
    4 = D4;
    5 = D3;
    0 = D8;

控制LED的代码如下

void setup() {
  pinMode(2, OUTPUT);     // Initialize the LED_BUILTIN pin as an output
}
// the loop function runs over and over again forever
void loop() {
  digitalWrite(2, LOW);   // Turn the LED on (Note that LOW is the voltage level
                                    // but actually the LED is on; this is because
                                    // it is active low on the ESP-01)
  delay(1000);                      // Wait for a second
  digitalWrite(2, HIGH);  // Turn the LED off by making the voltage HIGH
  delay(2000);                      // Wait for two seconds (to demonstrate the active low LED)
}

 

你可能感兴趣的:(esp32,esp8266)