# Soil Moisture 2.2 LED

**URL:** <https://bbs.aprbrother.com/t/soil-moisture-2-2-led/1009>\
**Category:** BLE Gateway\
**Created:** [June 8, 2017, 3:15pm UTC](https://bbs.aprbrother.com/t/soil-moisture-2-2-led/1009 "2017-06-08T15:15:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![bsculley](https://bbs.aprbrother.com/letter_avatar_proxy/v4/letter/b/a88e4f/32.png) [@bsculley](https://bbs.aprbrother.com/u/bsculley)\
**Post date:** [June 8, 2017, 3:15pm UTC](https://bbs.aprbrother.com/t/soil-moisture-2-2-led/1009/1 "2017-06-08T15:15:40Z")

</div>

I’m using the Arduino IDE to flash the Soil Moisture Sensor. I can’t seem to turn off the LED on GPIO13. Anybody had any experience with this? Here’s the code I’m using:

> const int Led = 13; // D7

> pinMode(Led, OUTPUT);  
> digitalWrite(Led, LOW);

---

<div class="post-metadata">

**Author:** ![aprilpea](https://bbs.aprbrother.com/user_avatar/bbs.aprbrother.com/aprilpea/32/9_2.png) [@aprilpea](https://bbs.aprbrother.com/u/aprilpea)\
**Post date:** [June 9, 2017, 2:22am UTC](https://bbs.aprbrother.com/t/soil-moisture-2-2-led/1009/2 "2017-06-09T02:22:34Z")

</div>

I tested the sketch and it works fine

```auto
/* 
 ESP8266 BlinkWithoutDelay by Simon Peter
 Blink the blue LED on the ESP-01 module
 Based on the Arduino Blink without Delay example
 This example code is in the public domain
 
 The blue LED on the ESP-01 module is connected to GPIO1 
 (which is also the TXD pin; so we cannot use Serial.print() at the same time)
 
 Note that this sketch uses LED_BUILTIN to find the pin with the internal LED
*/

int ledState = LOW;     

unsigned long previousMillis = 0;
const long interval = 1000;
const int LED = 13;

void setup() {
  pinMode(LED, OUTPUT);
}

void loop()
{
  unsigned long currentMillis = millis();
  if(currentMillis - previousMillis >= interval) {
    previousMillis = currentMillis;   
    if (ledState == LOW)
      ledState = HIGH; // Note that this switches the LED *off*
    else
      ledState = LOW; // Note that this switches the LED *on*
    digitalWrite(LED, ledState);
  }
}

```
