in

how to use EEPROM in Arduino

EEPROM Library

Arduino மற்றும் Genuino AVR அடிப்படையிலான குழுவில் உள்ள மைக்ரோகண்ட்ரோலரில் EEPROM உள்ளது. பலகை அணைக்கப்படும் போது (like a tiny hard drive) மதிப்புகள் வைக்கப்படும் நினைவகம். இந்த நூலகம் அந்த பைட்டுகளைப் படிக்கவும் எழுதவும் உங்களுக்கு உதவுகிறது.

பல்வேறு Arduino மற்றும் Genuino போர்டுகளில் ஆதரிக்கப்படும் மைக்ரோ கன்ட்ரோலர்கள் வெவ்வேறு அளவு EEPROM ஐக் கொண்டுள்ளன: 1024 bytes on the ATmega328P, 512 bytes on the ATmega168 and ATmega8, 4 KB (4096 bytes) on the ATmega1280 and ATmega2560. The Arduino and Genuino 101 boards have an emulated EEPROM space of 1024 bytes.

To use this library
#include <EEPROM.h>

Functions

Examples

  • EEPROM Clear: Clear the bytes in the EEPROM.
  • EEPROM Read: Read the EEPROM and send its values to the computer.
  • EEPROM Write: Stores values from analogue input to the EEPROM.
  • EEPROM Crc: Calculates the CRC of EEPROM contents as if it was an array.
  • EEPROM Get: Get values from EEPROM and prints as float on serial.
  • EEPROM Iteration: Understand how to go through the EEPROM memory locations.
  • EEPROM Put: Put values in EEPROM using variable semantics.
  • EEPROM Update: Stores values read from A0 into EEPROM, writing the value only if different, to increase EEPROM life.

Download “EEPROM” Mrtechies.com-Arduino-Tutorial-EEPROM-in-Tamil.zip – Downloaded 1000 times – 111 KB

Circuit diagram

EEPROM example

#include 
int leds[] = {4, 5, 6, 7, 8, 9, 10, 11, 12, 13};
int level = 0;
void setup() {
  Serial.begin(9600);
  for (int i = 0; i < 11; i++) {
    pinMode(leds[i], OUTPUT);
  }
  level = EEPROM.read(0);
  if (level > 10) {
    level = 5;
  }
}
int delaytime = 100;

long b1time = 0;
int b1state = LOW;
int lastb1state = LOW;

long b2time = 0;
int b2state = LOW;
int lastb2state = LOW;

void loop() {
  int b1_value = digitalRead(3);
  int b2_value = digitalRead(2);


  if (b1state != lastb1state) {
    b1time = millis();
  }
  if (millis() - b1time > delaytime) {

    if (b1state != b1_value) {
      b1state = b1_value;
      Serial.println(b1state);
      if (b1state == 1) {
        level++;
        EEPROM.write(0, level);
      }
    }
  }
  lastb1state = b1_value;


  if (b2state != lastb2state) {
    b2time = millis();
  }
  if (millis() - b2time > delaytime) {

    if (b2state != b2_value) {
      b2state = b2_value;
      Serial.println(b2state);
      if (b2state == 1) {
        level--;
        EEPROM.write(0, level);
      }
    }
  }
  lastb2state = b2_value;

  for (int i = 0; i < 11; i++) {
    if (i < level) {
      digitalWrite(leds[i], HIGH);
    } else {
      digitalWrite(leds[i], LOW);
    }
  }
}

Expanding EEPROM]

http://www.learningaboutelectronics.com/Articles/24LC256-EEPROM-circuit-with-an-arduino.php

Written by Admin

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

GIPHY App Key not set. Please check settings

what is the Arduino Network Communication

how to program attiny85/ATtiny13/13A with Arduino Uno