I will like to understand how does Arduino measure a frequency. Also how does my voltmeter can measure a frequency as well. Since I am a beginner on using microcontroler I would read a frequency like this:
void loop()
{
while(digitalRead(myPin)==HIGH)
{
// pin is high
}
// measure time using millis (this is the time the pin was high)
while(digitalRead(myPin)==LOW)
{
// pin is low
}
// measure time using millis (this is the time the pin was low)
}
With this code it makes sense to me how to measure a frequency and a duty cycle. The problem with this code is that it will probably be very slow and I it will probably read frequencies up to 100Hz and less.
So my questions are:
How can arduino read frequencies higher than 100Hz? How does it achieve that?
I Googled arduino's frequency and it shows to be 16MHz. That means arudino can read frequencies up to 16Mhz? Ethernet cables specifically CAT5 has a frequency of 100MHz. That means that it sends signals 100,000,000 in one second! How could Arduino send that many signals in one second if I where to buy a Ethernet shield such as this one?