Fio v3 + attachInterrupt()

Hey folks!

I nailed my problem pretty much down so I hope you guys can help me now because I think I've tried everything, you know how it is :slight_smile:

Short Story

attachInterrupt(2, foo, FALLING) doesn't work on D0 like it should on Fio v3 based on this http://arduino.cc/de/Reference/AttachInterrupt and assuming Fio v3 ~ Leonardo. Whereas it works on UNO with 0 as argument on D2.

Long Story

What I'm trying to achieve is to make a MPR121 Sensor work with the Fio v3 based on this code:

I got it working with the UNO, so my next step was to check out the correct pins for the Fio v3, like SDA goes to D2, SCL on D3 etc. Here I referred to this Schematic:

The main question where I had to do some research was where to map the interrupt to because with the original code

attachInterrupt(0, foo, FALLING);

I'd need to hook it up to D2 which now is used as SDA - so just set it to a free one right?! No.

That's where I'm currently stuck, I adapted the above code to

attachInterrupt(2, foo, FALLING);

and connected the IRQ wire to RXI / D0 Pin on my Fio v3 but it's not working. Do you have any idea how to debug this or what I could've done wrong here?

P.S.: I also stumbled upon this issue http://forums.adafruit.com/viewtopic.php?f=19&t=45652 but I'm not sure how far it's related. Just read in there that the Fio v3 board layout seems to be wrong so I used the pins_arduino.h one of the users links to with no effect (here: SF32u4_boards/pins_arduino.h at master ยท hi-pauls/SF32u4_boards ยท GitHub).

I got it working with the UNO, so my next step was to check out the correct pins for the Fio v3, like SDA goes to D2, SCL on D3 etc.

How did you arrive at that conclusion?

http://arduino.cc/en/Main/ArduinoBoardFio

External Interrupts: 2 and 3.
I2C: 4 (SDA) and 5 (SCL).

Perhaps the latter isn't clear that 4 and 4 refer to analog pins.

Other than how serial works, there is nothing fundamentally different between the Fio and the Uno.

Hey Paul, thanks for your time!

I never even thought about looking into specs of the original Fio you linked as I immediately looked at the docs of the Fio v3 by Sparkfun. As you can see, the Fio's Schematic and Pin Assignments http://arduino.cc/en/uploads/Main/Arduino-Fio-schematic.pdf are different to the ones of the Fio v3 http://dlnmh9ip6v2uc.cloudfront.net/datasheets/Dev/Arduino/Boards/Fio-v30.pdf.

That's how I came to the conclusion where to put the wires and what integer to set on attachInterrupt(). In the beginning I tried to do it like it's described for the Fio - A4 (SDA), A5 (SCL) and D2 (int1) for IRQ - it didn't work. Then I did the research, saw that pins are different but that also didn't help. That's why I'm here now :slight_smile:

I think you should be asking Sparkfun how to use their device, then, since it isn't really an Arduino.

That's what I'm going to do. Thank you for helping me out. Nevertheless I'll keep you guys updated!