¿ªÔÆÌåÓý

Re: Encoder tinning


Vince Vielhaber
 

You're going to get an error or warning for redefining r. You've definied it globally right under your include statement, then again in setup. In setup it's only local but you'll still get an error/warning.

Vince.

On 08/14/2017 08:21 PM, Norberto Modanesi wrote:
Hi folks:
What if I add these lines to the Raduino code
#include <Rotary.h>
Rotary r=Rotary(3, 2);

comment out analogtinnig A7

in setup()
Rotary r=Rotary(3, 2);

Then the interrupt routine
ISR(PCINT2_vect) {
unsigned char result = r.process();
if (result == DIR_CW)
counter=counter+1;
if(counter>1020){counter=1020;}
else if (result == DIR_CCW)
counter = counter-1;
if(counter<5){counter=5;}
Serial.println (counter);

}
Finaly, replace every analoRead(analogtunning) with counter.-

Would it work?

73 de LU5DNM

Norberto Modanesi
San Nicol¨¢s

--
Michigan VHF Corp.

Join [email protected] to automatically receive all group messages.