ESP8266

I just got a new ESP8266 board from eBay

image(https://drive.google.com/drive/u/0/folders/1V1LK3-K73W82DqHV8HwjGt9-z1oh8Lyp)

I've installed the driver suggested on the back CH340G. then I wrote and uploaded 'blinky'. The LED lights during the upload but then remains

const int pinLED = 0;
void setup() {
  pinMode(pinLED, OUTPUT);

}

void loop() {
digitalWrite(pinLED, HIGH);
delay(500);
digitalWrite(pinLED, LOW);
delay(500);

}

I know its not the sketch. I asked an 8 year old, and we're agreed. its not the sketch.
I tried changing the pin from D0 to D3 and wiring an LED with a R330 in series (its lights during the upload too) but did not get blinky to work there either.

I've tried several other boards listed, including three LoLin's and one WeMo's

image(https://drive.google.com/drive/u/0/folders/1V1LK3-K73W82DqHV8HwjGt9-z1oh8Lyp)
none of those find a port.
is it me, or is it my board?
Christ Kennedy

Hi, please read the forum guide in the sticky post. There you can learn how to post code and images correctly and what else to include in your post so that we can help you.

thank you for your reply,
I'm not sure which post in what sticky guide I'm supposed to read but I put a link to an image between (img)(/img) (round brackets instead of square here so you can see them) hypertext markers and they're still there but the picture doesn't appear.
(pre)(/pre) for the code and I'm not sure why that's an issue.

getting back to my question ...
I've tried pinMode() and digitalWrite(HIGH/LOW) for all the pins and surprisingly this works in different combinations but not others. sometimes I'll see pin2 blinking when its not even included in the list of pins to be toggled HIGH/LOW. other times none of them work although the same combinations that work once work a second and third time...?!? its a little odd. this seems like odd behaviour to me.
Christ Kennedy

The tricky thing about some ESP8266 boards is that the ESP8266 core for Arduino platform uses the GPIO numbers for the IO functions like digitalWrite(), but the pin labels written on the board don't match the GPIO numbers. So there are constants defined for these boards that map the pin labels on the board to the GPIO numbers. For example, here are the mappings for the WeMos/LOLIN D1 Mini board:

static const uint8_t D0   = 16;
static const uint8_t D1   = 5;
static const uint8_t D2   = 4;
static const uint8_t D3   = 0;
static const uint8_t D4   = 2;
static const uint8_t D5   = 14;
static const uint8_t D6   = 12;
static const uint8_t D7   = 13;
static const uint8_t D8   = 15;
static const uint8_t RX   = 3;
static const uint8_t TX   = 1;

So if your LED is connected to the pin on the board marked "D0", this code:

const int pinLED = 0;

is incorrect. Instead, it should be:

const int pinLED = D0;

It could also be:

const int pinLED = 16;

but then you need to remember the mapping. Much easier to just use the pin numbers marked on the board.

This is confusing because we're used to being able to use normal integers to identify the digital pins on our Arduino boards. I had the same confusion as you the first time I used an ESP8266.

Note that this was only an example, which applies to the D1 Mini board. Your board may have a different pin mapping. You need to select the correct board from the Arduino IDE's Tools > Board menu in order for the pin mapping to match the labels on the board. Your images are not shared publicly, so there is no way for us to provide guidance regarding which board you need to select.

thank you for your post,
I jumped out of my seat and straight to my desk when I read.
you really had my hopes up(and I was going to rag on that 8 year old for telling me my code was ok)

woo hoo! got it!
thanks

Christ Kennedy

You're welcome. I'm glad to hear it's working now. Enjoy!
Per