somebody know, how i can use the attachinterrupt(pin, code interrupt, low) because, i can not declare the another function that i made. inside the code interrupt.
void setup (){
Wire.begin(); //iniciar el bus de I2C
Serial.begin(9600);
pinMode(INTERRUPTPIN, INPUT);
initGyro();
sei();
attachInterrupt(0,interruptfinal,LOW);
}
void interruptfinal() {
byte aux=readByte(GYRO, G_INT_STATUS);
if (aux==00000001 || aux==00000101){
readFrom(GYRO, G_INT_STATUS, 8, gyro);
x = ((gyro[2] << 8) | gyro[3]);
y = ((gyro[4] << 8) | gyro[5]);
z = ((gyro[6] << 8) | gyro[7]);
temp = (gyro[0] << 8) | gyro[1];
}
void readFrom(int device, byte address, int num, byte buff[]) {
Wire.beginTransmission(device);
Wire.send(address);
Wire.endTransmission();
//RESTART CONDITION
Wire.beginTransmission(device);
Wire.requestFrom(device, num);
int i = 0;
while(Wire.available())
{
buff *= Wire.receive(); *
- i++;*
- }*
- Wire.endTransmission(); *
}