Pages: [1]   Go Down
Author Topic: unable to use EEPROM functions of ATtiny13A  (Read 583 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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);
  }
}
Logged

Denmark
Offline Offline
Edison Member
*
Karma: 35
Posts: 1057
Happy Hobbyist
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

If you are using smeezekitty's core  you can take a look at this:

http://forum.arduino.cc/index.php?topic=89781.150

Logged

Pages: [1]   Go Up
Jump to: