C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire\src/Wire.h: In function 'byte i2c_eeprom_read_byte(uint8_t, uint8_t)':
C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire\src/Wire.h:64:13: note: candidate 1: uint8_t TwoWire::requestFrom(int, int)
uint8_t requestFrom(int, int);
^
C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire\src/Wire.h:61:13: note: candidate 2: uint8_t TwoWire::requestFrom(uint8_t, uint8_t)
uint8_t requestFrom(uint8_t, uint8_t);
^
C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire\src/Wire.h: In function 'void i2c_eeprom_read_buffer(uint8_t, uint8_t, uint8_t*, int)':
C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire\src/Wire.h:64:13: note: candidate 1: uint8_t TwoWire::requestFrom(int, int)
uint8_t requestFrom(int, int);
^
C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire\src/Wire.h:61:13: note: candidate 2: uint8_t TwoWire::requestFrom(uint8_t, uint8_t)
uint8_t requestFrom(uint8_t, uint8_t);
[code]/*
* Use the I2C bus with EEPROM 24LC64
* Sketch: eeprom.ino
*
* Author: hkhijhe
* Date: 01/10/2010
*
*
*/
#include <Wire.h>
void i2c_eeprom_write_byte( int deviceaddress, unsigned int eeaddress, byte data ) {
int rdata = data;
Wire.beginTransmission(deviceaddress);
Wire.write((int)(eeaddress >> 8)); // MSB
Wire.write((int)(eeaddress & 0xFF)); // LSB
Wire.write(rdata);
Wire.endTransmission();
}
// WARNING: address is a page address, 6-bit end will wrap around
// also, data can be maximum of about 30 bytes, because the Wire library has a buffer of 32 bytes
void i2c_eeprom_write_page( int deviceaddress, unsigned int eeaddresspage, byte* data, byte length ) {
Wire.beginTransmission(deviceaddress);
Wire.write((int)(eeaddresspage >> 8)); // MSB
Wire.write((int)(eeaddresspage & 0xFF)); // LSB
byte c;
for ( c = 0; c < length; c++)
Wire.write(data[c]);
Wire.endTransmission();
}
byte i2c_eeprom_read_byte( uint8_t deviceaddress, uint8_t eeaddress ) {
byte rdata = 0xFF;
Wire.beginTransmission(deviceaddress);
Wire.write(eeaddress);
//Wire.write((int)(eeaddress >> 8)); // MSB
//Wire.write((int)(eeaddress & 0xFF)); // LSB
Wire.endTransmission();
Wire.requestFrom(deviceaddress,1);
if (Wire.available()) rdata = Wire.read();
return rdata;
}
// maybe let's not read more than 30 or 32 bytes at a time!
void i2c_eeprom_read_buffer( uint8_t deviceaddress, uint8_t eeaddress, uint8_t *buffer, int length ) {
Wire.beginTransmission(deviceaddress);
//Wire.write((int)(eeaddress >> 8)); // MSB
//Wire.write((int)(eeaddress & 0xFF)); // LSB
Wire.write(eeaddress);
Wire.endTransmission();
Wire.requestFrom(deviceaddress,length);
int c = 0;
while (c < length)
{
if (Wire.available())
{
buffer[c ++] = Wire.read();
}
}
}
void setup()
{
//char somedata[] = "this is data from the eeprom"; // data to write
Wire.begin(); // initialise the connection
Serial.begin(9600);
/*
i2c_eeprom_write_page(0x50, 0, (byte *)somedata, sizeof(somedata)); // write to EEPROM
delay(100); //add a small delay
Serial.println("Memory written");
*/
}
void loop()
{
uint8_t outputBuff[30];
uint8_t index;
//int addr=0; //first address
//byte b = i2c_eeprom_read_byte(0x50, 0); // access the first address from the memory
uint8_t devAddress = 0x50;
uint8_t eepromAddress = 0x00;
//while (1)
//{
/*
Serial.print((char)b); //print content to serial port
addr++; //increase address
b = i2c_eeprom_read_byte(0x50, addr); //access an address from the memory
*/
i2c_eeprom_read_buffer( devAddress, eepromAddress, outputBuff, 30 );
for (index = 0; index<30 ; index++)
{
Serial.print(*(outputBuff + index), HEX);
Serial.print(" ");
delay(50);
}
//}
Serial.println(" ");
delay(2000);
}
pert
June 6, 2018, 9:15am
2
When you encounter an error you'll see a button on the right side of the orange bar "Copy error messages". Click that button. Paste the error in a message here using code tags.
Are you getting error messages or warning messages ?
Does the code compile ?
UKHeliBob:
Are you getting error messages or warning messages ?
Does the code compile ?
code compiles, and gets programmed
raoul170:
code compiles, and gets programmed
What you are seeing are warning messages, not error messages