I've been fiddling with some code that I've found online, the python serial and python game classes.
Using another bit of code (i'll try to get some reference links later) I was able to get a few servos controlled by a joystick on the pc. The arduino waits for the serial value to change and sends info to digital pins 2-5.
Scouring the internet i found a gentleman that used an accelerometer to control channels through the trainer port of his rc transmitter, but he was using the analog pins and assigning each pin to an array and then to an array of pulses that he sent to pin 12 on the arduino.
I want to merge the two scripts, and instead of going directly to the servos from digital pins 2-5 take those values and convert them to a pulse signal i can send to the transmitter for an rc flight.
I know a bit about programming ( I work as a flash application developer).
After all that my question is:
How can I manipulate the serial input of the arduino, which is listening for a serial change from the joystick, into pulses I can send through a trainer cord to my RC transmitter?
In the code i researched, these gentlemen use a series of of high and low states in conjuction with a delay from a timer class. They send all 4- channels to the one pin in a matter of about 20ms or so. I understand the tech from reading their code, but im having a hard time accomplishing this.
The python code uses a servo class that sends information to the servo using a method called move(). it takes 2 parameters, the servo number (also the digital pin num) and the position in degrees. ex Servo.move(3,150), where Servo is the Class or the py file.
Can anyone help me figure this out?
What do you need from me for a better analysis?
So, I want to take whatever the arduino is sending to the 4 individual pins and send the information to a single pin with the pulse conversion stated above...
Thank you for your time!
Here is a video of the code i got working on my pc. Thank you!