Voltage divider & pull-up with analogRead
The Attiny has 6 pins that you can use as I/O.
While 5 of them are really easy to use the Pin 1, the Reset PIN , obviously Resets the Microcontroller if the voltage is lower than around 2.5v.
By reprogramming the fuses to use the reset pin as an I/O pin i'm not able anymore to use the arduino ISP Programmer.
So the only way to use it as input, without resetting the MC, is to stay over 3v and use analogRead?
After i finally got that, i played around a little with my multimeter (only measuring tool aviable) and experimented with resistors.
simulate this circuit – Schematic created using CircuitLab
The powersupply(battery) outputs around 5.11v.
not pressed i get 5.11v on the "reset pin".
pressed i get 3.41v on the "reset pin".
not pressed the resistace is 39K Ω.
pressed the resistace is 19K Ω.
Now, as i don't want to reprogramm the fuses or burn the Attiny85 my question is:
Can i harm somehow the attiny using this circuit with analogRead();
?
Readings would be around 680 when pressed or 1000 when not pressed.
Should i use other resistors to consume less current/send to much current continuously ? ... if this works...
Any other suggestions?
Notes.:
I use pins 2(PB3),3(PB4),5(PB0),6(PB1)
as PWM channels (with npn transistors);
Red,Green,Blue,white.
Used pin 7(PB2)
as button.but i need also a Potentiometer...
SO:
pin 7(PB2)
becomes Potentiometer (analogRead).
and , i hope
pin 1(PB5)
becomes a button using analogRead or whatever.
EDIT
this site explains more about the problem, although i need a simple button.
http://www.technoblogy.com/show?LSE
EDIT
I did not test the circuit above. I'm asking you if it could work , if there is something wrong. I have fear to damage the pin.
All i know is that:
- it resets with low voltage using normal potentiometer setup or normal button setup
if i set the fuses i'm not able to reprogramm the chip
pin1 = pb5 = adc0 = analogread(A0) = Arduino pin5 = RESET