- Sun May 31, 2020 2:53 pm
#87358
Hey, sorry for double posting. I thought the first post was not delivered.
I am issuing AT commands through Arduino code and it is my requirement to use AT commands. I have interacted NodeMCU with an Arduino Uno board.
In this case, is there any way to assign data transmission rate and measure the data transfer rate?
Here is my code:
#include <SoftwareSerial.h>
//Create software serial object to communicate with ESP8266
SoftwareSerial mySerial(9,10);//ESP8266 Tx & Rx is connected to Arduino #9 & #10
int i=0;
void setup()
{
//Begin serial communication with Arduino and Arduino IDE (Serial Monitor)
Serial.begin(115200);
//Begin serial communication with Arduino and ESP8266
mySerial.begin(115200);
delay(1000);
Serial.println("Initializing...");
mySerial.println("AT+CWMODE=3"); //configuring the ESP8266 module both as access point and station
updateSerial();
delay(1000);
mySerial.println("AT+CWSAP=\"ESP8266\",\"123456789\",11,4"); //setting the username, password, channel(11) for AP
updateSerial();
delay(1000);
mySerial.println("AT+CIPMUX=1"); //Establishing connection type
updateSerial();
delay(1000);
mySerial.println("AT+CIPSTART=3,\"UDP\",\"0.0.0.0\",0,4567,2"); //establishing UDP connection
updateSerial();
delay(2000);
for(i=2; i>1; i++)
{
mySerial.println("AT+CIPSEND=3,38,\"192.168.4.2\",4567"); //Sending out data
updateSerial();
mySerial.println("HELLO FROM THE AP. HOW ARE YOU CLIENT?");
mySerial.println("HELLO FROM THE AP. HOW ARE YOU CLIENT?");
updateSerial();
}
}
void updateSerial()
{
delay(700);
while (Serial.available())
{
mySerial.write(Serial.read());//Forward what Serial received to Software Serial Port
}
while(mySerial.available())
{
Serial.write(mySerial.read());//Forward what Software Serial received to Serial Port
}
}
void loop()
{
updateSerial();
}