I am using the Attiny85 programmed in the Arduino IDE. I was able to activate the internal pull-up resistors on pins 1 and 3, and the voltage I measured on them was close to the supply voltage of 5V.
However, when I activate the internal pull-up on pin 0 with
pinMode(0, INPUT);
digitalWrite(0, HIGH);
the voltage is only 1.77 V, and this is read as logic 0. Do you know why this could happen?
You have to verify which pin is used when you use 0 i think it´s based on the core files you implement into the IDE (pins_arduino.h file).
If 0 would be PB0 then you are on AREF and i don´t think its a good idea to activate a pull up here (maybe this is your problem), which sheet are you using for your pin definition ?
Alternatively you can use direct port manipulation to be sure on what pin you activate the pull-up.
There are 2 registers that are important to know to do that, the DDRx (Data Direction Register - defines pins as in-[0] or output[1]) and the PORTx register (for activating pull ups and other things which are not relevant here).
On page 64 of the Attiny 85 datasheet you can see only Port B registers are listed if you look closer a few pages under you can see each of theese registers have only 6 bits that can be altered (PB0-6). Normally all pins are initialized as input pins you can either check that by printing out the register or writing DDRB = 0;
When a pin is defined as input a 1 on the respective bit of the PORTB register activates a pullup on this pin.
The code for activating the pull-up on PB0 could look like this:
DDRB = 0;
PORTB = B000001; // setting the DDB0 bit
Damaged processor. Bug somewhere else in your code. Current flow because of something you have connected to pin zero. Battery in your meter is running down.
I'm referring to PB0 and I verified that I was controlling it because I removed the digitalWrite(0, HIGH) command, and it measured 0 V. Why does it matter that PB0 can also serve as AREF if I'm not using an external ADC reference? I added "analogReference(INTERNAL)" to see if it would make a difference, and it didn't.
Pin PB0 is not connected to anything and my meter measures other voltages correctly. I tried a different Attiny85 chip and I get the same result.
Not sure if it's also worth mentioning that I'm using this Tiny AVR Programmer: https://www.sparkfun.com/products/11801
You can select different internal references, i just checked my nano which is using the default value and i measured 0 aswell, sorry for that confusion. On another project i selected 2.56V reference and measured 2.56V on Aref that´s why i stated that earlier.
Have you tried my code ?
Try to explain a bit what your sketch is doing and which libraries you are using.
I have tried another chip. I have the chip plugged into the socket on the Tiny AVR programmer that is connected to a USB port. When I measure the voltage on other pins that have pull ups activated, the voltage is about 5 V, so I don't know why PB0 is acting differently.
If you have an arduino lying around try to power your chip with the rails from it on a breadboard or you could use the 5V and Gnd line from your programmer.