You my try the following approcah (I will try after this posting):
In order to upload sketch into ATtiny85 using Arduiono as ISP (Programmer), the RSTDISBL fuse bit must be in unprogrammed state (means: Pin-1 is a RESET/-pin).
You upload a sketch in which Pin-1 has been considered as an output line to blink a LED.
Now, use a AVR Programmer to program the RSTDISBL fuse bit (Pin-1 will work as IO line). You cannot change the fuse bits using Arduino as ISP Programmer.
Put the ATtiny on a breadboard, connect a LED at Pin-1 with a series resistor. Connect power supply and GND. Check if LED is blinking or not.
(Note: If you own a AVR Programmer, then their is no need to use Arduino as ISP (Programmer)).
I have performed my experimnet of post #22 and it is working.
Now, I cannot use the AVR Programmer to unprogram the RSTDISBL fuse bit as Pin-1 is no more available as RESET-pin which is necessary for ISP Protocol to work!
I have lost my one expensive ATtiny85!
Never mind!! The experiment helped me to learn!!!
Is there any way to recover the RESET-pin by unprogramming the RSTDISBL fuse bit?
So, the proposal to use RESET (A0) as IO looks like this:
And you use analogRead() to read the switch value. When the IO switch is not pressed, the pullup keeps the voltage at VCC (reads ~1023) and the device does not reset.
When you press IO, the pin voltage should be dropped by the voltage divider created, and analogRead() should read about 0.75*VCC (768), which is easily noticed, but not low enough to reset the chip.
When you press the RESET button, the signal is hard connected to GND, and the chip resets. (assuming that RESET is enabled.)
2. I undestand from the following excerpt (Fig-2) of data sheets that when one signal is activated, then the othet four signals should remain deactivated.
4. In your post #10, you have used Pin-1 as RESET pin and at the same time, you have used ADC0 channel to acquire analog signal of Pin-1 (Fig-4). The simultaneous use of two signals (RESET and ADC0) are not recommended by data sheets; but, you have done so in a cleverly way to meet your requirements. (I need to install R1 to see that at about 2.1V at RESET-pin, the MCU gets resetted; as a result, the ADC measurement range that I have got is: 2.2V to 2.7V.)
5. My next attempt is to measure the ADC0's voltage (range: 2.2V - 2.7V) and show it on I2CLCD or TM1637-based 7-seg Display Unit to see (for myself) that RESET-pin and ADC0 are working simultaneously. For my experiment, I am using Digispark ATtiny85 Dev Board.
6. My query is: why have you used controversial ADC0 channel (limited range) in the sketch of your post #10 when there are few full range ADC channels are available?
I have become interested on the following feature (Fig-1) of the USI Port of ATtiny85. Unfortunately, I don't find any description in data sheets on how to configure the USI Port to work as Asynchronous Port.
Better buy a Attiny with a UART, if you want to play with serial. Attiny2313/4313 have one and also a nice 16 Bit timer. I know they are stone-age, but I learned a lot by playing with them.
Thank you so much for guiding me to realize he UART implementation in ATtiny85. Having read the referenced documents, it is my understanding that the implemetation would be time consuming; moreover, the system clock of Digispark Board is also inaccurate (16.5 MHz).
So, for the time being, I am not working on it.
I am hooking up I2CLCD with the I2C Bus of the ATtiny85 of the Digispark Boad to monitor the value of ADC0 of Fig-4 of post #34.
If there is a voltage drop at the vcc (5v) of the attiny85, the reset pin wont work as analog pin?
I have a voltage at the vcc (4.66v) it is working ok and the led of battery indicator turn on but when the voltage go below 4.66v (same battery connected) the led do not turn on
Think about that if your VCC drops from 5V to 3,7 Volt and your Lipo stays at 3,7 Volt your analog reading will be 1023, which is higher than 700.
The lower your VCC, the more you will need to increase the 700 towards the 1023 maximum. Try it with <800 and see what happens.
This is a result of the fact that you are measuring the difference between VCC and your lipo. You are not measuring an absolute voltage. That difference is becoming smaller when VCC drops.