in my attempts , with my limited understanding , to use the wire library to write to an External EEPROM, no real use for it but just trying to learn ym way around the board through experiments , i cannot read and im guessing nor write to the chip
datasheet : http://ww1.microchip.com/downloads/en/devicedoc/21203m.pdf
using the following code which i think its pretty straight forward in terms of how the data is sent and what the chip expects.
begin transmission send high adress followed by low followed by my data then end transmission. I am also assuming wire takes care of the read/write bits?
#include <Wire.h>
int stuff = 255 ;
byte high = 0x00;
byte low = 0x00;
void setup()
{
Wire.begin(9,5);
SerialUSB.println("Initiating...");
pinMode(2, OUTPUT);
digitalWrite(2, HIGH);
}
void loop()
{
sendData(stuff);
delay(5000);
SerialUSB.println(readData());
}
void sendData(int data)
{
Wire.beginTransmission(0B1010000); // can also be written in Hex: 0x50
Wire.send(high);
Wire.send(low);
Wire.send(data);
Wire.endTransmission();
}
byte readData()
{
Wire.beginTransmission(0B1010000); // can also be written in Hex: 0x50
Wire.send(high);
Wire.send(low);
Wire.endTransmission();
Wire.requestFrom(0B1010000, 1);
return Wire.receive();
}