¿ªÔÆÌåÓý

ctrl + shift + ? for shortcuts
© 2025 Groups.io

Increment Problems


Dennis Stage
 

¿ªÔÆÌåÓý

Just got back. Been at my mountain property trying to get a cabin built.? Will all that you suggest later today.

Thanks for the input.


To: SoftwareControlledHamRadio@...
From: SoftwareControlledHamRadio@...
Date: Tue, 5 Apr 2016 20:22:04 -0500
Subject: RE: [SoftwareControlledHamRadio] Re: Increment Problems

?
Dennis,

Well I¡¯m stumped then. Bye the way, I hooked up a bare encoder without the external pull-up resistors (that is what is on the pcb) and it worked fine.

Can you load the example called ¡®INTERRUPT¡¯ that came with the library. Pull the Nano off the DDS VFO. Run the encoder to pins 2, 3, and ground (no 5 Vdc needed). Open the serial monitor (make sure it is at 9600 baud) as you turn the encoder it should print out CW or CCW.

Here is the code for it:

/*
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 r = Rotary(2, 3);

void setup() {
Serial.begin(9600);
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");
}
}


 

You are still using the wrong encoder library. I know this because the include does not use a capital 'R' for the file; it should be lowercase 'r'. Delete the Rotary library that comes with the IDE and install:




this library in its place. If you lose this email, the VFO source file has this line in it:

#include ? // From Brian Low: https://github.com/brianlow/Rotary

That should make a difference.

Jack, W8TEE


From: "Dennis Stage dennisstage@... [SoftwareControlledHamRadio]"
To: "SoftwareControlledHamRadio@..."
Sent: Thursday, April 7, 2016 10:16 AM
Subject: RE: [SoftwareControlledHamRadio] Re: Increment Problems

?
Just got back. Been at my mountain property trying to get a cabin built.? Will all that you suggest later today.

Thanks for the input.


To: SoftwareControlledHamRadio@...
From: SoftwareControlledHamRadio@...
Date: Tue, 5 Apr 2016 20:22:04 -0500
Subject: RE: [SoftwareControlledHamRadio] Re: Increment Problems

?
Dennis,

Well I¡¯m stumped then. Bye the way, I hooked up a bare encoder without the external pull-up resistors (that is what is on the pcb) and it worked fine.

Can you load the example called ¡®INTERRUPT¡¯ that came with the library. Pull the Nano off the DDS VFO. Run the encoder to pins 2, 3, and ground (no 5 Vdc needed). Open the serial monitor (make sure it is at 9600 baud) as you turn the encoder it should print out CW or CCW.

Here is the code for it:

/*
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 r = Rotary(2, 3);

void setup() {
Serial.begin(9600);
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");
}
}



Gary White
 

¿ªÔÆÌåÓý

Jack,

Now I am confused. The rotary library that came with the DDS-VFO is capitalized as is the include in the DDS into file. As is Brian Low¡¯s include library.

73

Gary


On Apr 7, 2016, at 10:41 AM, Jack Purdum jjpurdum@... [SoftwareControlledHamRadio] <SoftwareControlledHamRadio@...> wrote:


You are still using the wrong encoder library. I know this because the include does not use a capital 'R' for the file; it should be lowercase 'r'. Delete the Rotary library that comes with the IDE and install:




this library in its place. If you lose this email, the VFO source file has this line in it:

#include ? // From Brian Low:?

That should make a difference.

Jack, W8TEE


From:?"Dennis Stage?dennisstage@...?[SoftwareControlledHamRadio]" <SoftwareControlledHamRadio@...>
To:?"SoftwareControlledHamRadio@..." <softwarecontrolledhamradio@...>?
Sent:?Thursday, April 7, 2016 10:16 AM
Subject:?RE: [SoftwareControlledHamRadio] Re: Increment Problems

?
Just got back. Been at my mountain property trying to get a cabin built.? Will all that you suggest later today.

Thanks for the input.


To:?SoftwareControlledHamRadio@...
From:?SoftwareControlledHamRadio@...
Date: Tue, 5 Apr 2016 20:22:04 -0500
Subject: RE: [SoftwareControlledHamRadio] Re: Increment Problems

?
Dennis,

Well I¡¯m stumped then. Bye the way, I hooked up a bare encoder without the external pull-up resistors (that is what is on the pcb) and it worked fine.

Can you load the example called ¡®INTERRUPT¡¯ that came with the library. Pull the Nano off the DDS VFO. Run the encoder to pins 2, 3, and ground (no 5 Vdc needed). Open the serial monitor (make sure it is at 9600 baud) as you turn the encoder it should print out CW or CCW.

Here is the code for it:

/*
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 r = Rotary(2, 3);

void setup() {
Serial.begin(9600);
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");
}
}





 

The class name is capitalized, which is why you see the line:


Rotary r = Rotary(2, 3); ? ? ? // Create encoder object and set the pins the rotary encoder uses. ?Must be interrupt pins.


in the VFO source code (around line 97 in the VFO.ino source file). However, you also see:

#include ? // From Brian Low: https://github.com/brianlow/Rotary

at line 12 in the same file. So, the header file is rotary.h (small 'r') but the class name is Rotary (large 'R'). If you look in the Rotary library, you will see the files:

rotary.cpp
rotary.h

plus the Examples directory. I looked in the file that Farrukh has and it does have a capital 'R'. I'm attaching the three files I have to see if that makes a difference. Copy your library Rotary to a temp directory and then copy the two rotary files to the libraries\Rotary directory and see if they make a difference. I can't even compile the file Farrukh has! However, with these files, it should compile if the include uses a small 'r'.

Let me know what happens.

73,
Jack, W8TEE