Pages: [1]   Go Down
Author Topic: Getting byte (in character/alphabet) out of EEPROM  (Read 572 times)
0 Members and 1 Guest are viewing this topic.
Pakistan
Offline Offline
Sr. Member
****
Karma: 6
Posts: 357
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I am playing with EEPROM.. Have just wrote down a

Code:
#include <EEPROM.h>
int addr = 0;
void setup()
{
}

void loop()
{
  byte val = 'K';
  EEPROM.write(addr, val);
}

Now i want the EEPROM value back in character i.e. K, i am not succeeded so far:

Code:
#include <EEPROM.h>
int address = 0;
byte value;
void setup()
{
  Serial.begin(9600);
}
void loop()
{
  value = EEPROM.read(address);
  Serial.print(address);
  Serial.print("\t");
  Serial.print(value, DEC);
  Serial.println();
}

I don't know how to convert the EEPROM return value into character?
Logged


Pakistan
Offline Offline
Sr. Member
****
Karma: 6
Posts: 357
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Got it working:)
Code:
#include <EEPROM.h>
int address = 0;
byte value;
void setup()
{
  Serial.begin(9600);
}
void loop()
{
  value = EEPROM.read(address);
  char c=char(value);
  Serial.print(address);
  Serial.print("\t");
  Serial.print(c);
  Serial.println();
}
Logged


Pages: [1]   Go Up
Jump to: