8 Port relay module + ACS712, delay time not turning on for right amount of time

The readings basically output at the end my amperage, and total power consumption in watts.

I could have sworn that my readings for amperage and power were close to zero with no load.
Something else must be going on.

Basically the function of the program is to analyze power usage of whatever is connected to the relay.
Also it's for conducting cyclic testing.

However, it can be used for so much more. i.e. turning things off/on for certain periods of time and analyzing overall electrical usage.

I'll make the changes. I assuming this is to get rounded whole number. :slight_smile:
What does 5000UL mean?

5000UL mean 5000 but the UL tells the compiler to treat it as a unsigned long (UL). Because the compiler uses the biggest variable type in the calculation to do the calculation including all intermediate steps. For example, if you would do

unsigned int valA = 1000;
volatile unsigned int div = 500;
unsigned int outcomeA = valA * 5000 / div; //will become 38
unsigned int outcomeB = valA * 5000UL / div; //will become 10000 as expected

The intermediate outcome 5000000 does NOT fit a unsigned int and is cropped. Bu forcing it a unsigned long the math is correct again :slight_smile: