Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <Wire.h>
- #define eeprom 0x50
- byte B = 12;
- byte b = 0;
- unsigned int Direcion = 10;
- void setup()
- {
- Wire.begin();
- Serial.begin(9600);
- delay(6);
- }
- void loop(){
- Serial.print("Escribir ");
- Serial.print(B, DEC);
- Serial.print(" --> ");
- Serial.print(B, HEX);
- Serial.print(" HEX en ");
- Serial.print(Direcion);
- Serial.println();
- Wire.beginTransmission(eeprom);
- Wire.write((int)(Direcion >> 8));
- Wire.write((int)(Direcion & 0xFF));
- Wire.write(b);
- Wire.endTransmission();
- delay(5);
- Serial.print("Leer direccion : ");
- Serial.print(Direcion);
- Serial.print(" ... ");
- Wire.beginTransmission(eeprom);
- Wire.write((int)(Direcion >> 8)); // MSB
- Wire.write((int)(Direcion & 0xFF)); // LSB
- Wire.endTransmission();
- delay(5);
- Wire.requestFrom(Direcion,1);
- if (Wire.available()) {b = Wire.read();}
- Serial.print(b, HEX);
- Serial.print(" --> ");
- Serial.print(b, DEC);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement