Hi everyone!
I have a ATTiny85 that I use with capacitive touch and sometimes the ATTiny85 hang up and indicate that the touchplates is activated. Therefor I would like to restart/reboot the ATTiny85 but I'm not sure how to do that. I tried the SoftReset library but it didn't work for me. I tried some code:
#include <SoftReset.h>
#include <avr/power.h>
int led = 3;
int counter = 0;
void setup() {
if (F_CPU == 16000000) clock_prescale_set(clock_div_1);
// initialize the digital pin as an output.
pinMode(led, OUTPUT);
for(int ii=0; ii<5; ii++)
{
digitalWrite(led, HIGH);
delay(100);
digitalWrite(led, LOW);
delay(100);
}
}
//-----------------------------------------------------------------------------------
void loop()
{
counter++;
delay(100);
if(counter == 10)
{
soft_restart();
}
}
But it didn't work at all. Is something wrong with my code or is there a better solution?
My goal is to restart the ATTiny85 if one output pin is active for more than a few seconds (4 to 6 is no problem).
Can someone get me on the right track please.