Welcome to the Tweaking4All community forums!
When participating, please keep theĀ Forum RulesĀ in mind!
Topics for particular software or systems: Start your topic link with the name of the application or system.
For exampleĀ “MacOS X – Your question“, or “MS Word – Your Tip or Trick“.
Please note that switching to another language when reading a post willĀ not bring you to the same post, in Dutch, as there is no translation for that post!
It's been a very long time that I played with a rotary switch, but I think the biggest, and I've never used the Rotary library (I've found a few, but I'm assuming it is this rotary lib?), so I'm not sure what I'm even looking at.
Pins 2 and 3 seem a good choice since most common Arduino's support these 2 pins for attaching an interrupt to.
When looking at this example code for rotary.h; I see no purpose of A0?
/*
Rotary Encoder - Interrupt Example
The circuit:
* encoder pin A to Arduino pin 2
* encoder pin B to Arduino pin 3
* encoder ground pin to ground (GND)
*/
#include <Rotary.h>
Rotary r = Rotary(2, 3);
void setup() {
Serial.begin(9600);
r.begin();
PCICR |= (1 << PCIE2);
PCMSK2 |= (1 << PCINT18) | (1 << PCINT19);
sei();
}
void loop() {
}
ISR(PCINT2_vect) {
unsigned char result = r.process();
if (result == DIR_NONE) {
// do nothing
}
else if (result == DIR_CW) {
Serial.println("ClockWise");
}
else if (result == DIR_CCW) {
Serial.println("CounterClockWise");
}
}
With limited info and zero experience with the rotary library, I can only throw out some random thoughts.
From the rotary lib documentation, I assumed the rotary lib would already handle the interrupts. I could be very wrong though.
Next, you say it works on an Arduino Uno (assuming this is what you mean with Arduino 1???) but not on the mega it does not. Does the rotary example code for interrupts work?Ā (the one I just posted - copied from the rotary library documentation)
Oh cool! Good to know 👍🏻 Also thank you for posting the hint where to look -- others will benefit from it I'm sure.
Just being curious though; did you run the test on the Uno and the Mega? And both worked? Just wondering if the additional "A0" causes and unexpected problem on the Mega - It's not part of the rotary, right?
The call to the Rotary function accepts 3 arguments, the first two being the interrupt pins coming from the encoder and the third the pressed button present in the mechanical encoder.
Ubuntu Ubuntu is probably one of the most used Linux distro's out there. Very well supported and a great Linux distro
AlternativeTo Great resource when you're looking for alternatives for an application that you'd like to use, but might not be available on your platform or the application you have is just not doing it right.
MalwareBytes Probably one of the best tools to prevent and remove all kinds of malware and viruses on Windows and MacOS X.
Start-is-Back Ultimate Start-button replacement for Windows 8 and 8.1 - Super cheap, but highly recommended.
OpenElec The ultimate XBMC distribution. No operating system required, comes completely in a compact form with Embedded Linux, for Intel, AMD, AppleTV, Raspberry Pi, etc.
Links Page These and more of our favorite links can be found on the Links Page.
New Downloads
RenameMyTVSeries-2.3.10-QT5-Linux-x64-static-ffmpeg.tar.xzDate: 2025-08-23 - Size: 78.3 MBRename My TV Series, for Linux (64 bit QT5), a tool to assist in renaming TV Show episode files. This bundle comews with rather large static builds of ffmpeg and ffprobe.
RenameMyTVSeries-2.3.10-QT5-Linux-x64-shared-ffmpeg.tar.xzDate: 2025-08-23 - Size: 1.9 MBRename My TV Series, for Linux (64 bit QT5), a tool to assist in renaming TV Show episode files. This bundle relies on ffmpeg and ffprobe shared libraries on your system.
RenameMyTVSeries-2.3.10-GTK-Linux-x64-static-ffmpeg.tar.xzDate: 2025-08-23 - Size: 78.3 MBRename My TV Series, for Linux (64 bit GTK), a tool to assist in renaming TV Show episode files. This bundle comes with (large) static builds of ffmpeg and ffprobe.
RenameMyTVSeries-2.3.9-macOS-Universal.dmgDate: 2025-08-22 - Size: 100.5 MBRename My TV Series, for macOS (Universal binary for Apple Silicon ARM and Intel 64 bit), a tool to assist in renaming TV Show episode files. Static universal binary builds of ffmpeg and ffprobe are included.
RenameMyTVSeries-2.3.10-GTK-Linux-x64-shared-ffmpeg.tar.xzDate: 2025-08-22 - Size: 1.9 MBRename My TV Series, for Linux (64 bit GTK), a tool to assist in renaming TV Show episode files. This bundle relies on ffmpeg and ffprobe shared libraries on your system.
RenameMyTVSeries-2.3.9-Windows-x64-setup.exeDate: 2025-08-22 - Size: 49.1 MBRename My TV Series, for Windows (Intel 64 bit), a tool to assist in renaming TV Show episode files. Static builds of ffmpeg and ffprobe are included.
Downloads Page Find these and more Downloads on the Downloads Page, where you will also find articles references, operating system requirements and categories.
Amazon Ads
Support us by doing your shopping at Amazon.com, either click the link, or click one of the links below …
You can also sponsor us through theseĀ Amazon offerings:
Please consider disabling your ad blocker for our website.We rely on these ads to be able to run our website.You can of course support us in other ways (see Support Us on the left).