This title may not make any since, but its what I came up with.
I need to count the number of hot digital pins (the ones that are getting voltage) and if that number is less than 3 a fan comes on. If it is more than 3 an LED will come on. I just need to know how to “count” the hot pins…
Thanks in advance.
This answer may not make sense as there wasn't a question...
The Arduino comes with a fixed number of pins. There really is no reason to count them.
The number of pins that are in some state is a completely different story. Counting the number of pins who’s state is HIGH is trivial.
byte hotCount = 0;
for(byte b=0; b<pinCount; b++)
if(digitalRead(pinNumber[b]) == HIGH)
if(hotCount >= 3)
Just to clear things up I do not need to count the physical pins, that would be elementary. This "The number of pins that are in some state is a completely different story" is what i need.