when I was building my custom light 4 touch switch panel for my smartHomeDIY I discovered Arduino uno and nano has only 2 hardware interrupts, luckly,after searching for a while, I found a blog that helped me to overcome this limitation. The solution is: pin change interrupts which are supported by the Arduino uno and nano: . Regular hardware interrupts can be registered for raising or falling or change interrupt, but the pin change interrupts, as their name suggests, are only capable to deliver interrupts when the pin senses a voltage change in any direction, if you need to know which pin was changed you will have to read all pin states (or relevant pins) to know the new state and compare it to the old state (which you have to save on you program. a small workaround in my case was to register for 2 hardware interrupts and for the other 2 required interrupts I used the pin chagne mechanism, but there are good news, the pin change interrupts are grouped into group of pins
To read more about this topic I recommend the following:
Comments are closed.
|