I know this is an old post but it looks like you might be trying to analogWrite to pin 12 which doesn't support pwm on some arduino's.
I know this is an old post but it looks like you might be trying to analogWrite to pin 12 which doesn't support pwm on some arduino's.