ATtiny85 20PU analogread

Hi guys:

I'm new to Arduino and discover the ATtiny85 world maybe a bit early in my learning process.

I'm using that page to program my ATtiny85:
http://hlt.media.mit.edu/?p=1695

I'm using my Arduino 1.0 to program the ATtiny:
http://hlt.media.mit.edu/?p=1706

I had problem with a small prototype I have build which use a small potentiometer 25kOhms to configure some values.

So I've created a small test that probe the potentiometer.

My problem is that the analogRead seems to always return the same value on the ATtiny whatever the position of the potentiometer. When I connect the analogIntervalPin on the ground, instead of getting a 0 I get a reading a value greater than zero. I've also connect it on +5v and get the same high value. I cannot figure out what is the value but looks constant. I always get the led blinking 9 times. see code below.

I dont really know how to debug that so I've use a led to get some feedback.

Any idea what I may doing wrong?

int analogIntervalPin = A2;
int activateIntervalPotPin = 1;
int ledPin = 0;

void setup() {
  // declare the ledPin as an OUTPUT:
  //Serial.begin(9600);
  pinMode(activateIntervalPotPin, OUTPUT);    
  pinMode(ledPin, OUTPUT);
}

void loop() {
  digitalWrite(activateIntervalPotPin, HIGH);  
  int value = analogRead(analogIntervalPin);   
  digitalWrite(activateIntervalPotPin, LOW);     
  
  int convert = map(value, 0, 1024, 0, 10);

  blinkForReadValue(convert);  
  
  delay(2000);
  
}

void blinkForReadValue(int readValue) {
    digitalWrite(ledPin, HIGH);
    delay(1000);                  
    digitalWrite(ledPin, LOW);
    delay(500);                  

    for(int i = 0; i < readValue; i++) {
      digitalWrite(ledPin, HIGH);
      delay(150);                  
      digitalWrite(ledPin, LOW);
      delay(250);                  
    }

    delay(500);                      
}

Thanks for your help!

I've resolved my issue.

Apparently the problem come from the library I've download to program the ATtiny85 from https://github.com/damellis/attiny/archive/master.zip

If you get into the same kind of problem just download latest version from:
http://code.google.com/p/arduino-tiny/downloads/detail?name=arduino-tiny-0100-0015.zip

That thing is wonderfull my analog read work as expected now!

Appart from getting instructions on how to program an Attiny85 you should also burn the bootloader into the Attiny85 itself. Burning the bootloader would make your Attiny more compatible with Arduino IDE sketches. To burn it, first setup everything you do when you programm the attiny, but instead of uploading a sketch go to Tools > Burn Bootloader don't forget to seect the right port int Tools > Board menu. After that is accomplished you could now program the Attiny85 again and hopefully your analog reading will be good.

Hope this helps.