ESP8266/Blink

From Noisebridge Wiki
Jump to navigation Jump to search

ESP-01 module configured with adjustable voltage regulator and LED connected to GPIO2.

File:ESP-01 Blink bb.png

/*
  Blink
  Turns on an LED on for one second, then off for one second, repeatedly.

  Tweaked for ESP8266, connect LED to GPIO2 on ESP-## modules

  This example code is in the public domain.

  modified 8 May 2014
  by Scott Fitzgerald

  modified 1 Nov 2015
  by _ _ _ _
 */

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

// the loop function runs over and over again forever
void loop() {
  digitalWrite(2, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);              // wait for a second
  digitalWrite(2, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);              // wait for a second
}