Please excuse the newness/naivete of this question because I very new to this platform.
That said here is my scenario.
I have a sketch to control a Quadrotor vehicle and it uses ServoTimer2. It also has several individual sketches that cover several functions within that program such as reading sensors, writing to EEEPROM etc.
When I try to compile the main .pde, it fails because there are references within that part that are not "found and declared in that scope".
Here is the question. When I open the main .pde in the IDE, do I also have to add the other .pde files to the main .pde with the add file option??????
Like I said, I am very new to this platform and IDE.
Hi Jim,
You can combine code from multiple sketches, but make sure that there is only one loop() and one setup(). I find the easiest way to structure a complex sketch stitched together from different pieces of code is to use the tabs in the IDE to hold the individual code units.
Perhaps post the error messages and a fragment of your sketch
Being new to C and the Arduino tab function I have kind of wondered how and when to utilize tabbed in code. Can it be used somewhat as a kind of personal library structure? Are there any examples of utilizing 'tabbed' in code?
Thank you for the quick response. I kind of figured out that is what needed to be after reading more in the Arduino Reference after I posted my question.
When you say that there must be only one setup() and one loop(), is that to be only in the main sketch or only one in each of the additional sketches? Right off, I would think maybe only one in the main sketch?
Lefty, I think of the tabs as modules that together comprise the sketch logic. but I suppose you can think if it like a library private to one project.
"Jim,
Yep, only one setaup and loop. they can actually be anywhere but its more logical if its in the first tab"
Thank you MEM. I got the ServoDecode example working(?) I think.
It compiled fine and ran. At first I could not get it to work with my receiver or Transmitter so I changed to another TX/RX and it works. One thing though, when I move the sticks the pulsewidth doesn't seem to move. If I turn the TX off it goes to failsafe OK and wen I turn it back on, the pulsewidths come back up. They all remain at 1500 in spite of moving the TX sticks.
All in all though, it feels good to be able to interface with my TX.
No. I am trying to capture all of the channels. It is a Futaba 8UHF and I have a pinout for the frequency module. I connected the pin that is supposed to be the PPM output to Arduino as well as grounding the transmitter to the Board.. The result is a NO SYNCH. If I turn off the transmitter the serial monitor says it is in failsafe and the channels show up at 1500. I will try to find the pinout for the trainer plug and see if that will work.
I found the 4015 chip on the Futaba receiver and thought I had found the out pin, but I guess I didn't. I have an old RCD(pre-runner to the HiTec series) and it has a Pin on the plug for the battery and the signla pin on that connector has all the Channels in PPM. When I used that receiver on the transmitter, I was able to catch the PPM signlas and saw the pulsewidths. Guess I will try the Futaba receiver again in the morning with a clear head.
No need to try the trainer port if you have it working with another Rx
The signal you want is the input to the 4015 shift register, that could be either pin 7 or pin 15 depending on how it is wired in your rx. If you don't have a scope, try both.
Jim, good to hear you have it going. Looking forward to reading more about your project. I have wanted to build one myself but have not had the time. So looking forward to the vicarious enjoyment of reading about your progress