Go Down

Topic: Extract data from EEPROM to an array (Read 2901 times) previous topic - next topic

dgelectron

The code does something that's true. With "doesn't work" I just mean that it isn't what I want, you are right.
Code: [Select]

EEPROM.write(10, intento1[0]);
EEPROM.write(11, intento1[1]);
EEPROM.write(12, intento1[2]);
EEPROM.write(13, intento1[3]);
EEPROM.write(14, intento1[4]);

Serial.println(EEPROM.read(10));
Serial.println(EEPROM.read(11));
Serial.println(EEPROM.read(12));
Serial.println(EEPROM.read(13));
Serial.println(EEPROM.read(14));  

Whits this code the serial prints:

54
55
50
48
50

I already have byte 0 of EEPROM to store users number, that was a good idea!

dgelectron

I guess is something relative to the command "Serial.println" cause even it prints 55, 54, 50... the keypad recognizes it as '6', '7', '2'... So the problem seems to be over!

#include<EEPROM.h>
#include <PN532.h>
#include <SPI.h>
int led = 13;
int EEsize = 1;
int taha;
String input = "";
#define PN532_CS 10
PN532 nfc(PN532_CS);
#define NFC_DEMO_DEBUG 1
void setup(void) {
#ifdef NFC_DEMO_DEBUG
Serial.begin(9600);
Serial.println("Hello!");
#endif
nfc.begin();
pinMode(led, OUTPUT);
uint32_t versiondata = nfc.getFirmwareVersion();
if (! versiondata) {
Serial.print("Didn't find PN53x board");

while (1); // halt
}
#ifdef NFC_DEMO_DEBUG
Serial.print("Found chip PN5");
#endif
nfc.SAMConfig();
}
void loop(void) {
uint32_t id;long randNumber;
id = nfc.readPassiveTargetID(PN532_MIFARE_ISO14443A);
if (id==2999603015)
{
  Serial.println("ACCESS GRANTED");
Serial.println(" The unique number is sent to your registered mobile");

  for (int i = 0; i < EEsize; i++)
  {
    randNumber=random(255);
    Serial.println(randNumber);
    EEPROM.write(i, randNumber);
  }
  Serial.println();
  for (int a=0; a<EEsize; a++)
  {
    taha = EEPROM.read(a);
    Serial.print("EEPROM position: ");
    Serial.print(a);
    Serial.print(" contains ");
    Serial.println(taha);
    delay(2000);
   
   //Serial.print("\r");
  //delay(1000);                 
  //Serial.println("AT+CMGF=1\r");   
  //delay(1000);
  //Serial.println("AT+CMGS=\"+91944xxxxxx8\"\r");    //Number to which you want to send the sms
  //delay(1000);
  //Serial.println(" randNumber \r");   //The text of the message to be sent
  //delay(1000);
  //Serial.write(0x1A);
  //delay(1000);
  //
  if(Serial.available()){
  input += (int)Serial.read();
  delay(30);
//if(input =="taha");
  Serial.println("The unique number you entered is correct");
}

}
}

else if(id!=0)
{
Serial.println("ACCESS DENIED");
delay(2000);
digitalWrite(led, HIGH);
}
else
{
  Serial.println(" PLEASE DISPLAY YOUR MOBILE");
  delay(2000);
}
}
hey!how can i compare a data stored in eeprom using serial port monitor..... i am using serial functions to read and then compairng with eeeprom value "taha" but it is not comparing...can u help me out

Nick Gammon

@abdulmajidtaha: Please do not cross-post. This wastes time and resources as people attempt to answer your question on multiple threads.


http://arduino.cc/forum/index.php/topic,158767.0.html

- Moderator
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

Go Up