Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By smartgatto
#33035 Hello, my name's Marco and I am a newbie with this module... I have an ESP8266-12 connected to my pc with a FTDI board.
I try to upload on it nodeMCU firmware and seems it's all OK, but when I try to upload an example sketch (by arduino board), it upload the sketch but when I open serial port I can't see nothing.
The sketch is this:
Code: Select all#include <ESP8266WiFi.h>

const char* ssid = "Netgear";
const char* password = "password";

// Create an instance of the server
// specify the port to listen on as an argument
WiFiServer server(80);

void setup() {
  Serial.begin(115200);
  delay(10);

  // prepare GPIO2
  pinMode(2, OUTPUT);
  digitalWrite(2, 0);
 
  // Connect to WiFi network
  Serial.println();
  Serial.println();
  Serial.print("Connecting to ");
  Serial.println(ssid);
 
  WiFi.begin(ssid, password);
 
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }
  Serial.println("");
  Serial.println("WiFi connected");
 
  // Start the server
  server.begin();
  Serial.println("Server started");

  // Print the IP address
  Serial.println(WiFi.localIP());
}

void loop() {
  // Check if a client has connected
  WiFiClient client = server.available();
  if (!client) {
    return;
  }
 
  // Wait until the client sends some data
  Serial.println("new client");
  while(!client.available()){
    delay(1);
  }
 
  // Read the first line of the request
  String req = client.readStringUntil('\r');
  Serial.println(req);
  client.flush();
 
  // Match the request
  int val;
  if (req.indexOf("/gpio/0") != -1)
    val = 0;
  else if (req.indexOf("/gpio/1") != -1)
    val = 1;
  else {
    Serial.println("invalid request");
    client.stop();
    return;
  }

  // Set GPIO2 according to the request
  digitalWrite(2, val);
 
  client.flush();

  // Prepare the response
  String s = "HTTP/1.1 200 OK\r\nContent-Type: text/html\r\n\r\n<!DOCTYPE HTML>\r\n<html>\r\nGPIO is now ";
  s += (val)?"high":"low";
  s += "</html>\n";

  // Send the response to the client
  client.print(s);
  delay(1);
  Serial.println("Client disonnected");

  // The client will actually be disconnected
  // when the function returns and 'client' object is detroyed
}


My ESP connection:

VCC>3.3v
CH_PD>3.3v
TX>Rx (FTDI)
RX>Tx (FTDI)
GPI00>GND
GPI015>GND
GND>GND

It's all correct?
Thank you!
User avatar
By brutzler
#33045 Hi,

look at Niels Book: http://neilkolban.com/tech/wp-content/uploads/2015/08/The-ESP8266-Book-August-2015.pdf
Page 16 and 17

BTW: Try a NodeMCU. Its an ESP8266-12E with the whole roundabout. You only need to connect to USB-Port.
The chineseman takes less than 8 EUR.
User avatar
By smartgatto
#33179 Ok...thank you... I order a NodeMCU (10 euro).

while the time it will arrive, I try to continue to use my ESP8266-12.. I re-do all the connection and now it is ok, BUT.....
If I set the FTDI-usb at 3.3v the ESP don't boot, instead if I set the FTDI at 5v the ESP boot and connect to my router but it is so hot.. so I must stop experiment...
I don't understand...
how can it's possible???