He's not redefining the object r. He is defining an unsigned char variable named result into which he is assigning the return value from the process() method of the ?r object. There should be no compiler error from that.
From: Vince Vielhaber <vev@...> To:[email protected] Sent: Tuesday, August 15, 2017 10:58 AM Subject: Re: [BITX20] Encoder tinning
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 > > >