ajit_nayak87
Member level 5
I am trying to serial communicate between arduino and Nodemcu.I have connected my nodemcu & Arduino uno as shown in figure.
NodeMCU should send char in format 01 03 0000 0000 FD. Arduino should receive this string If data is valid price welcome else print hello.
Arduino code
nodemcu code
NodeMCU should send char in format 01 03 0000 0000 FD. Arduino should receive this string If data is valid price welcome else print hello.
Arduino code
Code:
int val = 0;
int incoming = 0;
int incoming1 = 0;
void setup()
{
Serial.begin(115200); //Begin Serial to talk to the Serial Monitor
Serial.println("Serial Monitor Connected");
Serial.parseInt(); //clear any garbage in the buffer.
}
void loop()
{
// From the Rx Arduino
incoming1 = Serial.available();
while(incoming1 != 0) //While there is something to be read
{
val = Serial.parseInt(); //Get new value
Serial.print("Receiving... ");
Serial.println(val); //Print new value to the Serial Monitor
incoming1 = Serial.available();
}
}
nodemcu code
Code:
int val = 0;
int incoming = 0;
unsigned int i;
byte Send_buf[] = {0x01,0x03,0x00,0x00,0x00,0x0a,0xFD};
void setup()
{
Serial.begin(115200);
}
void loop()
{
incoming = Serial.available();
while (incoming != 0) //While there is something to be read
{
Serial.write(Send_buf[0]);
}
//delay(200);
}