Reading a PWM signal with an Analog Input - strange LED behavior

Hi

I just noticed something I find strange and was wondering If someone could explain this to me.

I got myself two Arduino Pro Minis (the 3v3 version). I am playing around with different ways of letting the communicate. I wanted to see if I could read the PWM output of a digital pin of Arduino 1 with an Analog Input of Arduino 2.

I wrote a short sketch which fades an LED on and off which works as expected.

Next step was, to connect the minus of the LED to an Analog Input of the second Arduino. What happened is that the LED stopped fading and instead started Pulsing very visibly (my guess is about 1 or 2 times per second.) I disconnected it again, as I am not sure whats happening and I want to keep these boards for a while.

Both Arduinos are powered by a LiPo battery, regulated to output 5 volt (I know that isn't really necessary, but its in a bundle with a charger...). I am connecting the LiPo to the RAW power pin. The Arduinos and the battery have a common ground.

Any ideas?

I wanted to see if I could read the PWM output of a digital pin of Arduino 1 with an Analog Input of Arduino 2.

That won't work anyway, at the very least you would have to run the PWM through a low-pass filter. But this is possibly the silliest method of communicating I've ever heard of.

connect the minus of the LED to an Analog Input of the second Arduino.

Is there a resistor involved here? Is the LED still connected to GND through a resistor?

You'll have to draw us a circuit I think, but bear in mind my first comment. Why?


Rob

fkeel: I wanted to see if I could read the PWM output of a digital pin of Arduino 1 with an Analog Input of Arduino 2.

Despite the name, analogWrite() is not an analog signal. So your Analog Input is only going to see a 0V or 5V level, depending on when it samples the signal.

You could, however, use pulseIn() to determine the pulse-width of the Pulse Width Modulated signal.