Applying multiple but same sensors

Hello! I have a question, will this work if I plan to use multiple CT sensors?

#include "EmonLib.h"
// Include Emon Library
EnergyMonitor emon1, emon2, emon3;
// Create an instance
void setup()
{
  Serial.begin(9600);

  emon1.current(1, 111.1);             // Current: input pin, calibration.
  emon2.current(2, 111.1);
  emon3.current(3, 111.1);
  
}

void loop()
{
double Irms1 = emon1.calcIrms(1480);  // Calculate Irms only
double Irms2 = emon2.calcIrms(1480);
double Irms3 = emon3.calcIrms(1480);

  Serial.print(Irms1*230.0);           // Apparent power
  Serial.print(" ");
  Serial.println(Irms1);             // Irms
  Serial.print(" ");
  Serial.print(Irms2*230.0);
  Serial.print(" ");
  Serial.println(Irms2);
  Serial.print(" ");
  Serial.print(Irms3*230.0);
  Serial.print(" ");
  Serial.println(Irms3);
}

Note: I got the raw code here: How to Build an Arduino Energy Monitor - Measuring Mains Current Only — OpenEnergyMonitor 0.0.1 documentation. And I only adjusted the codes based on what my limited knowledge in programming.

I think so. I don't see anything wrong in your code.
In

emon1.current(1, 111.1);

the first parameter is the analog pin number the sensor is connected to, here A1.

lesept:
I think so. I don't see anything wrong in your code.
In

emon1.current(1, 111.1);

the first parameter is the analog pin number the sensor is connected to, here A1.

Do I have to change 1 into A1, is that what you mean? Or in case of emon2.current(2, 111.1), I have to connect it to A2 and so on.

Thanks for replying, I'm afraid of testing it in actual first in case of failure equipment.

OneLeafAutumn:
Do I have to change 1 into A1, is that what you mean?

No, you don't have to change it you can use either 1 or A1 and it will be the same. I personally prefer using the Ax notation for analog pins since that makes it more clear about which pin is being referenced.

Or in case of emon2.current(2, 111.1), I have to connect it to A2 and so on.

Yes, you will have to connect the second one to A2, then A3, etc.

I wouldn't have said better... :wink: