I’m issuing commands on a timer, but there’s no “event trigger” on my server when it’s time to issue the next command, and no verification that commands were received (aka “byzantine generals” problem). There’s just a “Right now it should be set to X” variable that is sent to the imp every 10 seconds.
I have two working solutions, and I’m wondering which one is more energy/battery efficient:
if( hardware.pin8.read() != desired_value)
hardware.pin8.write(desired_value);
versus
hardware.pin8.write(desired_value);
I’m wondering if the overhead of the extra .read() is “costing” me anything, and how it’s cost would compare to writing a value that’s already been written.
In short: On a hardware level, does writing a 1 still cost me an electron if it was already a 1, and how many electrons does .read() cost me by comparison?