Leds, Relays, GPIO, whatever


#1

Wondering what is the difference between these two ways of basically doing the same thing.
I’ve used both, and don’t see any real difference.

This:
{
if (getValue.asInt() == 0) {
digitalWrite(7, LOW);
}
else {
digitalWrite(7, HIGH);
}
}

Versus this simpler method:
{
int value = getValue.asInt();
digitalWrite(ACTUATOR_PIN, value);
}

Thanks,
John


#2

both are same. one is using "if " condition while other is directly writing the value to actuator pin.