Posted by : MC 11 Temmuz 2015 Cumartesi


ESP8266 really cheap and stable solution for making a wireless internet connection with arduino.
In this example we will try to make a project esp8266 and arduino nano.

What we need?

We need another serial communitacion interface to interact with esp8266.For this purpose we will use sofware serial.Esp8266 has 9600 baud rate we need to remember this.

SoftwareSerial Serial1(10,11);
void setup()
{
  Serial.begin(9600);
  Serial1.begin(9600);
  
  Serial.flush();
   Serial1.print("AT+RST\r\n"); // reset for esp8266
   delay(500);
   Serial1.flush();//clear serial1
  Serial1.print("AT+CIFSR\r\n");// learn the ip which token for esp8266
  delay(500);
  if(Serial1.find("ready"))
  {
    Serial1.flush();
     Serial1.print("AT+CIFSR\r\n");
  delay(500);
  Serial.println("CIHAZ IP ADRESI:"+Serial1.readString());// print esp8266 ip

  }
  else
  {
    Serial.println("there is no internet connection");
  }
  Serial1.print("AT+CIPMUX=1\r\n");//ser mux 1 so we want to connect as multiple users
  delay(500);
  if(Serial1.find("OK"))
  {
    Serial.println("Mux ok");
  }
  else
  {
    Serial.println("MUX failed");
  }
  Serial1.print("AT+CIPSERVER=1,23\r\n");// set esp8266 as server
  delay(500);
  if(Serial1.find("OK"))
  {
    Serial.println("SERVER started");
  }
  else
  {
    Serial.println("SERVER failed");
  }
  
}
void loop()
{

   if(Serial1.available())
    {
       Serial.print(Serial1.readString()); // get message which comes from clients.
    }
}

{ 1 yorum... read them below or add one }

  1. Merhaba elimde esp 8266 bulunuyor. Data gönderip/almak için android ve arduino bağlantısını nasıl sağlarım ?

    YanıtlayınSil

ELEKTRO BLOGGER A HOŞGELDINIZ

ARAMA YAP

EN COK OKUNANLAR

- Copyright © ELEKTRO-BLOGGER Blogger