Hi,
I have the following Problem. I use on a Project a Arduino Uno with some external Stuff. On the one side I have a SPI driven Matrix which is driven via a Timer based Interrupt on the Arduino. Now I like to read in Data from a i2c based Sensor which generates Low Edges on a interrupt Line. The Interrupt at the Low Edge for the Sensor works without Problem. But now I like to read the data from the Sensor when the Interrupt from the Sensor happens. Every Time I done this the Arduino crashes. What can I do?
My Routine for reading the Sensor looks like this:
int matrixkey2()
{
int buffer;
Wire.beginTransmission(0x38);
Wire.requestFrom(0x38, 1);
delay(100);
while(Wire.available() == 0);
buffer = Wire.read();
if(buffer & 0x01)
{
return 1;
}
if(pcf_buffer & 0x02)
{
return 2;
}
if(buffer & 0x04)
{
return 3;
}
else
{
return 0;
}
}
If I let this routine running in the loop everything works great. But I like to get this running if the Interrupt on the Falling Edge happens. And if I attach the routine to the Interrupt it goofs completly up when the Interrupt happens.
Berkutta