I am new to using the arduino processor. I wrote a program to control a servo using the command “pulseIn” (to read the width of the servo pulse from the RC receiver) and the command “writeMicroseconds” (to write the pulse out again). The width of the pulse varies approximately +/- 30 microseconds. This causes the servo to move back and forth.
Question: Does this processor use interrupts for the instruction “pulseIn” or is it polling?
I have used the “pic” processors previously and used interrupts to determine the width of the receiver pulses. Should I go back to using “Pic” processors.
there is some code out there that will supposedly do this using a hardware level feature of the ATmega However I couldn’t get that particular feature to work on my arduino (uno) So it may be limited to some of the more “intense” AT chips. The second link is the one using the hardware level implimentation the first is a general purpose one that you’ll probably be familiar with.
I’ve noticed a jitter in my servos to when using the pulsein function. One option you have is to do some basic filtering, either averaging two or three pulses or dumping data that is less than X different from the last reading. This is probably the route I will go vs. creating my own function. I’m not exactly a code monkey so my results will probably be worse than the pulsein function. Unless you can come up with a nice function, I might pilfer that from you if you are kind enough to post it.