Multitasking? How?

PaulS:

The pulse is generated by the power meter on the side of my house at the rate of one pulse per one watt-hour consumed.

Then, the pulses are happening FAR more often than once an hour. A 100 watt light bulb is going to use 100 watt-hours per hour, or one watt-hour in 36 seconds. Fire up the electric dryer or electric oven and the pulses come hot and heavy.

Paul, who stated the pulses were once per hour? A few posts up (and below) I stated when my home is idle they were every 6-8 seconds. Where are you taking this thread?

dotJason:
The pulse is generated by the power meter on the side of my house at the rate of one pulse per one watt-hour consumed.
...
but if timing matters the pulses when my home is pretty idle come around 6-8 seconds, so it took about a half-hour to trip on itself.
[/quote

Paul, who stated the pulses were once per hour?

Sorry. Reading too many threads too early in the morning. I got your issues mixed up with another one.

dotJason:
... when it increment to 256 it just starts outputting that value repeatedly.

dotJason:
I'd like to know why it "overflowed" ...

Here's how I see it:

The test that decides whether to print the "Meter Pulse Registered >>" message is a comparison between wattHourPulses and oldPulsesPer60s. wattHourPulses is unsigned long, and oldPulsesPer60s is byte. oldPulsesPer60s will never be bigger than 255, while wattHourPulses can get really big. Once wattHourPulses reaches 256, the test will always pass, and the message will print every time loop executes. The speed of the serial interface will probably be what limits rate of the the output messages; at 115200, they'll come pretty fast. If you let the program run until another pulse occurred, it would print " ... = 257," but it would print a whole lot of 256's before that happened.

The changes that you describe in reply #15 solve the problem by resetting wattHourPulses often enough to keep it from reaching 256 with a reasonable household load. To hit 256 watt-hours in 60 seconds would take a total load of about 15.4 kW, which is quite a lot for a typical residence, but certainly not impossible. I'd recommend declaring oldPulsesPer60s differently if you want to use the previous version of the code.

I pedantically note that the value reported as "kWh" is probably not labeled correctly. If each pulse represents a watt-hour, then that value is in kW - energy per unit time, or power - rather than kWh.