Hey, I just wanted to thank you for working through all this code and making an awesome library set.
I'm having some weird things going on when trying to use the PPMout example code. I've only changed the number of channels to 6 and added the additional analog pins.`/ --------------------------------------------------------------------------- This software is in the public domain, furnished "as is", without technical support, and with no warranty, express or implied, as to its usefulness for any purpose.
ppmout_example.pde Demonstrate Pulse Position Modulation Output functionality Author: Daniel van den Ouden Project: ArduinoRCLib Website: http://sourceforge.net/p/arduinorclib/ -------------------------------------------------------------------------/
include <ppmout.h></ppmout.h>
include <timer1.h></timer1.h>
define CHANNELS 6
uint8_t g_pins[CHANNELS] = {A0, A1, A2, A3, A4, A5}; // Input pins
uint16_t g_input[CHANNELS]; // Input buffer in microseconds
uint8_t g_work[PPMOUT_WORK_SIZE(CHANNELS)]; // we need to have a work buffer for the PPMOut class
// PPMOut requires two buffers:
// Input buffer containing input samples in microseconds
// Work buffer of ((channels + 1) * 2) elements for internal calculations and frame buffering
// This setup removes any limit on the number of channels you want, and makes sure the library doesn't use more
// memory than it really needs, since the client code supplies the buffers.
rc::PPMOut g_PPMOut(CHANNELS, g_input, g_work, CHANNELS);
void setup()
{
// Initialize timer1, this is required for all features that use Timer1
// (PPMIn/PPMOut/ServoIn/ServoOut)
rc::Timer1::init();
for(uint8_ti=0; i < CHANNELS; ++i)
{
//setupinputpinspinMode(g_pins[i], INPUT);//fillinputbuffer, convertrawvaluestomicrosecondsg_input[i] =map(analogRead(g_pins[i]), 0, 1024, 1000, 2000);
}
//initializePPMOutwithsomesettingsg_PPMOut.setPulseLength(448); // pulse length in microsecondsg_PPMOut.setPauseLength(10448); // length of pause after last channel in microseconds//note: thisisalsocalledtheendofframe, orstartofframe, andisusuallyaround10ms//startPPMOut, usepin9(pins9and10arepreferred)g_PPMOut.start(9);
}
void loop()
{
// update the input buffer
for (uint8_t i = 0; i < CHANNELS; ++i)
{
// fill input buffer, convert raw values to microseconds
g_input[i] = map(analogRead(g_pins[i]), 0, 1024, 1000, 2000);
}
So, I would assume that the PPM signal I generate would look something like: 1.5, 2, 1.55,2,2,2 (in total length).
However, when comparing it with the PPM out signal from my FSi6 (with a logic analyzer), they aren't even close. I've attached the images of the logic.
My end goal is to generate a PPMout with the arduino and feed it into the PPMin of my FSi6 transmitter.
Do you have any thoughts as to why this is happening?
weird...
I haven't touched this code in 5 years or so, so there might have been changes in the Arduino landscape that broke this bit of functionality, but it's more likely that I messed up somewhere...
I'll see if I can find a working Arduino in my parts collection and test it somewhere this week...
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hey, I just wanted to thank you for working through all this code and making an awesome library set.
I'm having some weird things going on when trying to use the PPMout example code. I've only changed the number of channels to 6 and added the additional analog pins.`/ ---------------------------------------------------------------------------
This software is in the public domain, furnished "as is", without technical
support, and with no warranty, express or implied, as to its usefulness for
any purpose.
ppmout_example.pde
Demonstrate Pulse Position Modulation Output functionality
Author: Daniel van den Ouden
Project: ArduinoRCLib
Website: http://sourceforge.net/p/arduinorclib/
-------------------------------------------------------------------------/
include <ppmout.h></ppmout.h>
include <timer1.h></timer1.h>
define CHANNELS 6
uint8_t g_pins[CHANNELS] = {A0, A1, A2, A3, A4, A5}; // Input pins
uint16_t g_input[CHANNELS]; // Input buffer in microseconds
uint8_t g_work[PPMOUT_WORK_SIZE(CHANNELS)]; // we need to have a work buffer for the PPMOut class
// PPMOut requires two buffers:
// Input buffer containing input samples in microseconds
// Work buffer of ((channels + 1) * 2) elements for internal calculations and frame buffering
// This setup removes any limit on the number of channels you want, and makes sure the library doesn't use more
// memory than it really needs, since the client code supplies the buffers.
rc::PPMOut g_PPMOut(CHANNELS, g_input, g_work, CHANNELS);
void setup()
{
// Initialize timer1, this is required for all features that use Timer1
// (PPMIn/PPMOut/ServoIn/ServoOut)
rc::Timer1::init();
}
void loop()
{
// update the input buffer
for (uint8_t i = 0; i < CHANNELS; ++i)
{
// fill input buffer, convert raw values to microseconds
g_input[i] = map(analogRead(g_pins[i]), 0, 1024, 1000, 2000);
}
}`
I've got 4 out of my 6 pins tied HIGH while the other two have pots attached. I tested the analog read with this code:
So, I would assume that the PPM signal I generate would look something like: 1.5, 2, 1.55,2,2,2 (in total length).
However, when comparing it with the PPM out signal from my FSi6 (with a logic analyzer), they aren't even close. I've attached the images of the logic.
My end goal is to generate a PPMout with the arduino and feed it into the PPMin of my FSi6 transmitter.
Do you have any thoughts as to why this is happening?
Cheers,
weird...
I haven't touched this code in 5 years or so, so there might have been changes in the Arduino landscape that broke this bit of functionality, but it's more likely that I messed up somewhere...
I'll see if I can find a working Arduino in my parts collection and test it somewhere this week...