It seems that analogWrite does not work when being used with pulseIn.
Here is some simple code:
void loop()
{
int pulse = pulseIn(3,100);
pulse -= 1020;
if(pulse < 0)
pulse = 0;
pulse = 420 - pulse;
pulse *= 0.607;
Serial.println(pulse);
analogWrite(13,pulse);
}
The value of pulse is verified to be 0-255 by printing out the value, but the LED on pin 13 doesnt get dimmer/brighter, it only turns on or off at mid range. Any ideas?