this is the code i uploaded to my ATtiny13A using my Arduino UNO as an ISP Programmer...
the program is like if i cut my IR sensor for 7 times .. then only my led switches on..
i want it in such a way that even if the power for the ic is cut off the ic should start from the point where it
stopped ...so i am storing the number of times i cut the sensor in EEPROM of the ic...
but the EEPROM part of the code is not working..
i need a bit of help here on how to write and read the EEPROM of ATtiny13A...??
please...
#include<EEPROM.h>
int ir=1;
int led=4;
int a=0;
boolean b=LOW;
void setup()
{
pinMode(led,OUTPUT);
pinMode(button,INPUT);
a=EEPROM.read(0);
if(a==7)
{
a=0;
}
}
void loop()
{
if(digitalRead(button)==HIGH&&b==LOW&&a<7)
{
a++;
EEPROM.write(0,a);
b=HIGH;
}
if(digitalRead(button)==LOW&&b==HIGH)
{
b=LOW;
}
if(a==7)
{
digitalWrite(led,HIGH);
}
}