Posted by : MC
11 Temmuz 2015 Cumartesi
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.
}
}
Benzer Konular :
- Ana Sayfaya Dön »
- arduino es8266 server , arduino esp8266 connection , arduino project , arduino wifi server »
- ARDUINO AND ESP82666
Merhaba elimde esp 8266 bulunuyor. Data gönderip/almak için android ve arduino bağlantısını nasıl sağlarım ?
YanıtlaSil