I'm currently tinkering with some weather sensors and have found a strange problem when I try to add the ENC28J60 EthernetShield to my setup.
I've the following block to calculate the frequency of the MTF3223 (HS1101) humidity sensor:
long getFrequency(int pin)
long freq = 0;
for (unsigned int j = 0; j < FREQUENCY_SAMPLES; j++)
long f = pulseIn(pin, HIGH, 250000);
if (f == 0)
freq += 500000 / f;
return freq / FREQUENCY_SAMPLES;
It works OK on a barebone Uno and 2009, but as soon as I add the enc28j60 shield the reported frequency jumps up approx +1khz
This happens even if I don't add / initialize the ethernet library.
The shield is one of these: http://cgi.ebay.com/ENC28J60-Ethernet-Shield-Arduino-Duemilanove-/250771510445
Any clues what I'm doing wrong? I'm not using any of the pins that are used by the Shield (2,10,11,12,13)