hello ,am new to this forum.so any mistake happen please don't mind.
my question is how to make communicate with nodemcu with pc via max485.i just tried a simple program but that's not worked.any one please help me.
one more thing for sending data to nodemcu am using serail lab in my pc.
here is my code
#include <ModbusMaster.h>
#include <SoftwareSerial.h>
ModbusMaster node;
void setup()
{
pinMode(7, INPUT_PULLUP);
Serial.begin(9600);
delay(100);
node.begin(1,Serial);
delay(100);
}
void loop()
{
node.writeSingleRegister(4,digitalRead(7));
Serial.print("[4] ");
Serial.print(digitalRead(7));
delay(20);
Serial.print(" ");
node.readHoldingRegisters(5,1);
Serial.print("[5] ");
Serial.println(node.getResponseBuffer(0));
delay(20);
node.clearResponseBuffer();
}
if anybody have knowledge about this please help me.thanku