mandulaj / PZEM-004T-v30

Arduino library for the Updated PZEM-004T v3.0 Power and Energy meter
MIT License
259 stars 109 forks source link

The question is a lot of targeting. What if I use more than one device? #5

Closed kkwestt closed 4 years ago

kkwestt commented 4 years ago

The question is a lot of targeting. What if I use more than one device? protocol have multichannel addressing

pmoser56 commented 4 years ago

Since you can not identfiy the devices on a single interface, use multiple interfaces.

mandulaj commented 4 years ago

@kkwestt, you can give each device an address and then create an instance for each device with that address. See the PZEMChangeAddress example

You can create an instance with a specific address as PZEM004Tv30 pzem(11, 12, <address>);

I hope this helps. If you have any more questions, don't hesitate to ask!

luispopity commented 4 years ago

I could put an example with 2 modules operating on the same port, thanks

mandulaj commented 4 years ago

What you could do is use the 'change-address' program to give each device a specific address. Then in your actual program you can pass this address to the pzem instance as I have shown above. PZEM004Tv30 pzem(11, 12, <address>);

luispopity commented 4 years ago

ok, I did it, but first put the address with the software changeadress, thanks