You will turn that output pin into an input pin, and your reading depends on what is connected to the pin.
Where a pin was last used with a PWM comman[d], a digital read of the pin without first performing a mode change statement will just read the last value written to the pin's data register. The voltage at the pin will remain to be the last value written by the pwm command
Post-bottom-line note: The digitalRead() function disconnects the timer from the pin, so PWM is no longer applied to the output. It definitely does not automatically set the pin mode to input, and the result is that the pin's bit value in the output register is applied to the pin. Subsequent analogWrite() function calls can be used to connect the timer signal to the PWM pin again.Finally, note that if you execute an analogWrite() function to a pin that is not one of the PWM pins, the function writes a zero if the byte value is less than 128, and writes a one if the byte value is greater than or equal to 128.
It's also interesting to see the behavior of analogWrite() to a non-PWM pin - definitely not what I expected!
I'd expect it to output 1 if the write value is anything but zero, like the digitalWrite() behavior.
Please enter a valid email to subscribe
We need to confirm your email address.
To complete the subscription, please click the link in the
email we just sent you.
Thank you for subscribing!
via Egeo 16