Discuss here different C compiler set ups, and compiling executables for the ESP8266

User avatar
By pop48m
#52722
martinayotte wrote:
pop48m wrote:but no progress yet.

Did you called pinMode(2, OUTPUT) in your setup() ?

The program I would like to make working is an example installed with other Espressif software.
Code: Select all/*
   The obligatory blinky demo
   Blink an LED on GPIO pin 2
*/

#include <ets_sys.h>
#include <osapi.h>
#include <gpio.h>

// see eagle_soc.h for these definitions
#define LED_GPIO 2
#define LED_GPIO_MUX PERIPHS_IO_MUX_GPIO2_U
#define LED_GPIO_FUNC FUNC_GPIO2

#define DELAY 500000 /* microseconds */

extern void ets_wdt_enable (void);
extern void ets_wdt_disable (void);

void user_rf_pre_init(void)
{
}

void user_init(void)
{
   uint8_t state=0;
   ets_wdt_enable();
   ets_wdt_disable();
   // Configure pin as a GPIO
   PIN_FUNC_SELECT(LED_GPIO_MUX, LED_GPIO_FUNC);
   for(;;)
   {
      GPIO_OUTPUT_SET(LED_GPIO, state);
      os_delay_us(DELAY);
      state ^=1;
   }
}
User avatar
By pop48m
#52801
martinayotte wrote:I don't see any thing wrong there.
And it doesn't work ?
Do you have proper power supply, because bad one can produce crashes even before reaching user_init()

It doesn't work yet. Power supply is OK. I have two units, bought at ebay, and both of them behave the same.
Today I got a NodeMCU board, and this program, as well as Hello world, are working properly. Hence, I suspect that these two boards are faulty.
What do you suggest as the simplest way to establish their correctness?