I'm trying out a simple sketch on a ATtiny85. I use the Sparkfun Tiny AVR programmer and a few simple sketches worked but the one below didn't. It's supposed to dim the LED on pin 0 depending on the voltage on the A1 pin but there's no dimming at all. I connected a potentiometer across pin 8 and 7 (A1). Turning the pot back and forth makes no difference. When I disconnected the pot and measured the voltage between A1 and GND I read 1.4V. There can't be any dimming if there's voltage on that pin all the time. What is going on with this little thing?
int pwmPin = 0; int analogInPin = A1; pinMode(pwmPin, OUTPUT); pinMode(analogInPin, INPUT); int analogIn = analogRead(analogInPin); // Read analog voltage on pin 2 (A1) analogWrite(pwmPin, analogIn / 4); // Output analog reading to dimmable LED