Chat freely about anything...

User avatar
By NopItTwice
#64189 I tried to compile and flash the blink example from esp-open-sdk. Compiling and flashing works as expected, without any errors. But the LED is not blinking.

I am using one of these development boards: https://www.aliexpress.com/item/10PCS-L ... 56329.html

The rgb led is always on btw. But I'm expecting the tiny LED on the esp-12e module to blink and it doesn't. It does blink rapidly while flashing though and it also flashes once every time I reset it.

Code: Select allesptool.py v1.2-dev
Connecting...
Auto-detected Flash size: 32m
Running Cesanta flasher stub...
Flash params set to 0x0040
Writing 32768 @ 0x0... 32768 (100 %)
Wrote 32768 bytes at 0x0 in 2.9 seconds (91.8 kbit/s)...
Writing 188416 @ 0x40000... 188416 (100 %)
Wrote 188416 bytes at 0x40000 in 16.3 seconds (92.2 kbit/s)...
Leaving...


...

So I installed the Arduino IDE, hoping that it would at least work with that. But no it doesn't. It does flash and compile. But after flashing the LED still doesn't blink.
In addition to that the rgb LED stays dark after flashing with the Arduino IDE. (Not that I care, it's just weird.)

I'm using Linux Mint.
User avatar
By NopItTwice
#64198 After hours and hours of frustration, I finally got it to work.
Apparently the blink examples I was using assumed the LED to be wired to GPIO 1, when in fact the ESP-12-E has its LED wired to GPIO 2. So I changed the code to use GPIO 2 and everything worked like a charm.

For the Arduino IDE this worked for me:

Code: Select all/*
 ESP8266 Blink by Simon Peter
 Blink the blue LED on the ESP-01 module
 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
*/

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 acive 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)
}


And for manual compiling/flashing this did the job:

Code: Select all#include "ets_sys.h"
#include "osapi.h"
#include "gpio.h"
#include "os_type.h"

static const int pin = 2;
static volatile os_timer_t some_timer;

void some_timerfunc(void *arg)
{
  //Do blinky stuff
  if (GPIO_REG_READ(GPIO_OUT_ADDRESS) & (1 << pin))
  {
    // set gpio low
    gpio_output_set(0, (1 << pin), 0, 0);
  }
  else
  {
    // set gpio high
    gpio_output_set((1 << pin), 0, 0, 0);
  }
}

void ICACHE_FLASH_ATTR user_init()
{
  // init gpio sussytem
  gpio_init();

  // configure UART TXD to be GPIO1, set as output
  PIN_FUNC_SELECT(PERIPHS_IO_MUX_U0TXD_U, FUNC_GPIO1);
  gpio_output_set(0, 0, (1 << pin), 0);

  // setup timer (500ms, repeating)
  os_timer_setfn(&some_timer, (os_timer_func_t *)some_timerfunc, NULL);
  os_timer_arm(&some_timer, 500, 1);
}
User avatar
By schufti
#64200 this can happen if you didn't choose the right "board".
As good practise you should choose a (similar) board based on the used module.

For the RGB-LED and the button FYI:
PIN 4: Button below antenna on top board, pulls low when pressed
PIN 12: green LED in RGB-LED
PIN 13: blue LED in RGB-LED
PIN 15: red LED in RGB-LED