Library doesn't return anything or work in any way

I’m trying to make a library, but it isn’t going well. It doesn’t work at all, and there are no error codes. If i try to read, it return nothing. Whole Serial “crashes” with that library. Any ideas what’s wrong? Also if you guys know how to reduce the size of the library (it uses lot of memory) i would like to hear how!

.ino

#include <Tweep.h>
#define eepid 80
Tweep eperom;

void setup() {
Serial.begin(9600);

delay(500);
eperom.write(eepid,0,88);
Serial.println("----------");
for(int x=0;x<255;x++) {
Serial.print(x);
Serial.print(" |");
Serial.println(eperom.read(x));
}
}

void loop() {

}

.h

#ifndef tweep_h
#define tweep_h

#include "Arduino.h"

class Tweep{
public:
void write(int device, uint8_t eeaddress, byte data);
int read(int addr);

private:
int dida = 0xFF;

};
#endif

.cpp

#include <Arduino.h>
#include <Wire.h>
#include "Tweep.h"

void Tweep::write(int device, uint8_t eeaddress, byte data) {
Wire.beginTransmission(device);
Wire.write(eeaddress);
Wire.write(data);
Wire.endTransmission();
delay(20);
}

int Tweep::read(int addr) {
dida = 0xFF;
Wire.beginTransmission(0x50);
Wire.write(addr);
Wire.endTransmission();
Wire.requestFrom(0x50,1);
if(Wire.available()>0){
dida = Wire.read();
}
return dida;
}

keywords.txt

write	KEYWORD1
read	KEYWORD2

library.properties

name=tweep
author=****
maintainer=****
sentence=Library for I2C EEPROM
paragraph=Simple way to control the EEPROM
category=Data Storage
url=nan
architectures=avr
version=0.0.1
core-dependencies=arduino (>=1.5.0)

Try including Wire.h in your .ino file.

It doesn't make any difference, still not working.

If you run an I2C scanner sketch does your EEPROM show up at address 80 (0x50)?

Ok i got it working by changing all uint_8 to int.

Each class has a special function known as a constructor, which is used to create an instance of the class. The constructor has the same name as the class, and no return type. I don't see this in your class.

J-M-L: Each class has a special function known as a constructor, which is used to create an instance of the class. The constructor has the same name as the class, and no return type. I don't see this in your class.

If the class needs no initialization then the automatically generated default constructor is fine.

@john

sure - I was thinking he might need some. probably needs a Wire.begin() somewhere