I have made a project where I am reading all the parameters from an Energy Meter. I want to publish all the data to a local webpage. I made the webpage and able to send the parameter name. But I am not able to send the Parameter value.
The issue I noticed is that, whenever I am running the code without adding the Ethernet.h library, It's showing all the values correctly in serial monitor. But When I am initializing the library, it's neither showing value in serial monitor nor in webpage. Only throwing Parameter name (i.e Total Active Energy etc.). I am even tried putting constant value but same issue.
if (c == '\n' && currentLineIsBlank) {
// send a standard http response header
client.println("HTTP/1.1 200 OK");
client.println("Content-Type: text/html");
client.println("Connection: close");
client.println();
// send web page
client.println("<!DOCTYPE html>");
client.println("<html>");
client.println("<head>");
client.println("<title>Monitoring</title>");
client.println("</head>");
client.print("<meta http-equiv=\"refresh\" content=\"5\">");
client.println("<body>");
client.println("<h2>Monitoring Page</h2>");
client.println("<p>A web page from the Arduino server</p>");
//--------------------------------------------------------------------------------
uint16_t TAE, TAE1, TAE2;
TAE = node.readInputRegisters(0x01, 2);
Serial.print("Total Active Energy: ");
client.print("Total Active Energy: ");
if (TAE == 0)
{
TAE1 = node.getResponseBuffer(0x00);
TAE2 = node.getResponseBuffer(0x01);
long int num_1 = (((unsigned long)TAE1 << 16) | TAE2);
float numf_1;
memcpy(&numf_1, &num_1, 4);
Serial.print(numf_1);
Serial.println(" kWh");
client.print(numf_1);
client.println(" kWh");
}
uint16_t IAE, IAE1, IAE2;
IAE = node.readInputRegisters(0x03, 2);
Serial.print("Import Active Energy: ");
client.print("Import Active Energy: ");
if (IAE == 0)
{
IAE1 = node.getResponseBuffer(0x00);
IAE2 = node.getResponseBuffer(0x01);
long int num_2 = (((unsigned long)IAE1 << 16) | IAE2);
float numf_2;
memcpy(&numf_2, &num_2, 4);
Serial.print(numf_2);
Serial.println(" kWh");
client.print(numf_2);
client.println(" kWh");
}