Hi all,
just a quick question: I am planning to use the I2C pins SDA/SCL on a leonardo but also the digital pins 2 and 3. They are on different places but looking at the 32u4 diagramm they are the same? I also plan to use the external interrupts (0 and 1) for pins 2 and 3. Is there any confilct or I can go ahead?
TIA
Manu
There is indeed a conflict and you can't use I2C and user interrupts at the same time on the Leonardo. The fact that the latest shield pin layout duplicates the I2C pins is done for flexibility for shield developers so that the same shield can work on different boards i.e. Uno and Mega boards. This and other 'details' is why I never recommend the Leonardo board over the standard Uno board unless you have a project where you need the board to act like a USB host to some attached USB slave device in which case the Leonardo is a good choice, otherwise the Uno is just a better board for using the vast number of user libraries and projects posted on the web.
OK so I need two more pins I will probably use the analog ones that I dont use yet...
I actually prefer leonardo because I need to communicate with a gps module over serial and its always better to have the USB working at the same time for debug.
I also have a problem for the interrupts on leonardo: I would like to have a pin change interrupt when A0,A1 or A2 changes (used as digital inputs).
TIA,
Bye
Manu
unless you have a project where you need the board to act like a USB host to some attached USB slave device in which case the Leonardo is a good choice,
No it does not act as a host it acts as a client but as well as looking like a serial port it can look like a keyboard or mouse, that is a HID class USB.
Why not just build a library based on a timer that emulate "softwarelly" a interrupt and the event that come with it? It wont be the real thing, and it might take some resources, but it will work.
Hi,
I'm not sure what you mean Frederic...
Anyway I found a way out by using the Pin Change interrupt, which is actually not well documented for Leonardo, it is different enough from the Uno to be confusing but now it works!
Bye
Manu