Buy an Axon, Axon II, or Axon Mote and build a great robot, while helping to support SoR.
0 Members and 1 Guest are viewing this topic.
int enc1;int enc2;void enc1isr (void) { if (!enc1) { enc1 = 10; // do the normal stuff }}void enc2isr(void) { if (!enc2) { enc2 = 10; // do the normal stuff }}void TimerISR(void) { if (enc1) enc1=enc1-1; if (enc2) enc2=enc2-1;}
Better option would be to debounce your encoders with electronics.something like thishttp://www.bioinspired.com/users/ajg112/electronics/debounce.shtml
I understand what you mean but a timer here isn't necessary...I use timer1 to do speed calc but then it's just it....
my personal opinion: you don't know to code well. no good programmer uses pause for such important tasks. also, this kind of stuff is usually mantained by a separate mcu. polish up your skills.another thing might be that you're using low quality encoders. don't settle for anything lower than optical.
In essence the theorem shows that an analog signal that has been sampled can be perfectly reconstructed from the samples if the sampling rate exceeds 2B samples per second, where B is the highest frequency in the original signal.
@cosmin: how do you like it here? I see you're close to the hundred posts, glad you're enjoying
I read the encoder inputs as interrupts, but there are not noise free... in fact they give a a hell of noise... (debounce effect)
To clear this out my problem is that on a optic transition I may get more clicks than I want