I found your library after looking for a replacement to the standard servo library and wanted to use/test it. I'm basically using pulseIn to read the 8 channels of my FlySky R8B receiver, clean up the raw values, and output to a few servos, h-bridges, or anything. After implementing output to one servo, I believe that the interrupts used for servo output were interfering with my pulseIn functions.
If I add ArduinoRCLib to my Arduino IDE and include ServoOut.h in my sketch how would I output a value to a servo? I didn't see any documentation or help other than the examples and opening the header files?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The ServoOut example is what you should be looking at. You have to specify a list of output pins to which you connect your servos, a buffer with input values (in microseconds), and a work buffer. You'll have to initialize Timer1 (which takes care of timing and generating the servo signal), initialize the buffers and start the ServoOut object. In the loop you'll need to read the signal from your receiver, update the input buffer, and tell servoOut that new values are available in the buffer. Most of this is demonstrated in the ServoOut example, you'll just need to replace the "g_pinsIn" parts with your pulseIn code. The example reads analog values and converts them to microseconds (1000 - 2000 range).
Be aware of the following:
If you're reading a PPM signal containing all channels from a single pin, then you need to keep in mind that pulseIn only reads the length of a pulse. However, PPM signals encode the channel value as the time between two pulses, not the length of a pulse. See https://sourceforge.net/p/arduinorclib/wiki/PPM%20Signal/ for more info.
Also please be aware that cheap micro servos may cause a lot of electronic noise and need to be decoupled properly, I've had loads of problems by hooking up multiple servos directly to the Arduino board; they mess up the control signals significantly.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I didn't realize that the pde file is an arduino sketch. After looking at the sketch I get the bulk of what is going on.
I have some of those cheap servos and I love them for their price. I haven't had to decouple them when using my trusty lantern battery for bench testing but knew I will have to for projects with regulators.
Thanks for the reply!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Makes sense, up till Arduino 0.22 (which was the latest version when ArduinoRCLib was created), sketch files were names .pde, as of Arduino 1.0 they use .ino as file extension, but I forgot to rename the examples :)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
That's not a big deal but the Arduino IDE wants to move the sketch into a folder that has the exact same name as the sketch. This is a minor detail and wanted to point them out if/when you update the examples. I could do these changes my self and send them back if that would help.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
Anonymous
-
2013-03-13
Somehow SourceForge makes my reply anonymous :/ Oh well...
Anyway, that's odd, which version of Arduino are you using? The 1.0.2 version I have installed here happily accepts .pde files for the examples. After extracting the zip file into the libraries folder the examples become available under file->examples->RC
I've created ticket [#58] for this issue, it's on the list for the next release. Thanks for reporting :)
I found your library after looking for a replacement to the standard servo library and wanted to use/test it. I'm basically using pulseIn to read the 8 channels of my FlySky R8B receiver, clean up the raw values, and output to a few servos, h-bridges, or anything. After implementing output to one servo, I believe that the interrupts used for servo output were interfering with my pulseIn functions.
If I add ArduinoRCLib to my Arduino IDE and include ServoOut.h in my sketch how would I output a value to a servo? I didn't see any documentation or help other than the examples and opening the header files?
The ServoOut example is what you should be looking at. You have to specify a list of output pins to which you connect your servos, a buffer with input values (in microseconds), and a work buffer. You'll have to initialize Timer1 (which takes care of timing and generating the servo signal), initialize the buffers and start the ServoOut object. In the loop you'll need to read the signal from your receiver, update the input buffer, and tell servoOut that new values are available in the buffer. Most of this is demonstrated in the ServoOut example, you'll just need to replace the "g_pinsIn" parts with your pulseIn code. The example reads analog values and converts them to microseconds (1000 - 2000 range).
Be aware of the following:
If you're reading a PPM signal containing all channels from a single pin, then you need to keep in mind that pulseIn only reads the length of a pulse. However, PPM signals encode the channel value as the time between two pulses, not the length of a pulse. See https://sourceforge.net/p/arduinorclib/wiki/PPM%20Signal/ for more info.
Also please be aware that cheap micro servos may cause a lot of electronic noise and need to be decoupled properly, I've had loads of problems by hooking up multiple servos directly to the Arduino board; they mess up the control signals significantly.
I didn't realize that the pde file is an arduino sketch. After looking at the sketch I get the bulk of what is going on.
I have some of those cheap servos and I love them for their price. I haven't had to decouple them when using my trusty lantern battery for bench testing but knew I will have to for projects with regulators.
Thanks for the reply!
Makes sense, up till Arduino 0.22 (which was the latest version when ArduinoRCLib was created), sketch files were names .pde, as of Arduino 1.0 they use .ino as file extension, but I forgot to rename the examples :)
That's not a big deal but the Arduino IDE wants to move the sketch into a folder that has the exact same name as the sketch. This is a minor detail and wanted to point them out if/when you update the examples. I could do these changes my self and send them back if that would help.
Somehow SourceForge makes my reply anonymous :/ Oh well...
Anyway, that's odd, which version of Arduino are you using? The 1.0.2 version I have installed here happily accepts .pde files for the examples. After extracting the zip file into the libraries folder the examples become available under file->examples->RC
I've created ticket [#58] for this issue, it's on the list for the next release. Thanks for reporting :)
Related
Tickets: #58