I like to know if there is a change with the interrupts from Nano to Nano Every? I could not find anything in the attachInterrupt help and also the chip documentation is not helpful for me as a beginner. Actually I only know that the nano supports interrupts on D2 and D3 only.
I like to immediatly react on a change on a digital pin which is a error input. It should directly change another digital pin. Thats because I like to use interrupts. Btw. I read something in the documentation that looks like interrupts are also available for analog pins called events???
The only note I could fine in the data sheet is:
in names are of type Pxn, with x being the PORT instance (A,B,C, ...) and n the pin number. Notation forsignals is PORTx_PINn. All pins can be used as event input.2. All pins can be used for external interrupt, where pins Px2 and Px6 of each port have full asynchronousdetection.
On classic nano, there are "external interrupts" that work on pins 2 and 3 (int0, int1) and attachInterrupt, plus PCINTs on all pins.
On nano every, there is only one kind of interrupt, it works on all pins (but only the full async pins can wake from sleep on rising/falling - the rest can only wake from sleep on low level or change), and can be used with attachIntereupt. Or can be done manually if you prefer (I consider attachInterrupt to be an abomination)
Hello, Welcome to the Arduino Forum. This guide explains how to get the best out of this forum. Please read and follow the instructions below. Being new here you might think this is having rules for the sake of rules, but that is not the case. If you donât follow the guidelines all that happens is there is a long exchange of posts while we try to get you to tell us what we need in order to help you, which is frustrating for you and frustrating for us. The people who try to help with your project.
It will help you get the very best out of the forum in the future.
Mention if you are using AI generated code it is important information.
Your OS and version can be valuable information, please include it along with extra security you are using. Antivirus etc.
Always list the version of the IDE you are using and the board version if applicable.
Use quote or CODE tags to add error messages as an attachment NOT a picture.
DrAzzy:
On classic nano, there are "external interrupts" that work on pins 2 and 3 (int0, int1) and attachInterrupt, plus PCINTs on all pins.
On nano every, there is only one kind of interrupt, it works on all pins (but only the full async pins can wake from sleep on rising/falling - the rest can only wake from sleep on low level or change), and can be used with attachIntereupt. Or can be done manually if you prefer (I consider attachInterrupt to be an abomination)
Perfect, that the information I need. Many thanks. Do you know if it is possible to set an interrupt on an analog input like it is send if voltage is below 4V?
@Bob: Sorry, missed that you moved my first post to this forum and thought it was somehow deleted or not posted.
Do you know if it is possible to set an interrupt on an analog input like it is send if voltage is below 4V?
You can do this by using the analog comparator with an internally generated reference voltage. Have a look at the MegaCoreX Comparator library.
MegaCoreX is a 3rd party addon to Arduino IDE, and Arduino Nano Every is supported. It brings more features to the table, and currently supports all megaAVR-0 chips.
If you look at the Comparator interrupt example, you can easily modify it to trigger when the voltage crosses a certain level. Basically all you need to do is to change the reference to ref::vref_4v, and tune the dacref value to match exactly 4V.