TiboJ:
- I've read the following about the WP controller: The default pins for RC mode are D0 and D1. As these are also the serial communications pins used for programming. You must disconnect cables connected to these pins when uploading a new program or usinging the serial port for diagnostics.
So I can't upload sketches with a USB?
I've read it here: http://sites.google.com/site/daguproducts/home/tutorials/understanding-wild-thumper
That reads, and I quote:
Control and Communications:
The default settings in the sample code allow the controller to be controlled using a standard RC receiver. In this mode pulsewidths from the receiver are measured and converted to speed and direction for the two motors. The default pins for RC mode are D0 and D1. As these are also the serial communications pins used for programming. You must disconnect cables connected to these pins when uploading a new program or usinging the serial port for diagnostics. If you have spare I/O pins then you can redefine "RCleft" and "RCright" in the "IOpins.h" tab of the sample code. Other servos can be plugged directly into the RC receiver to create a fully radio controlled robot.
So - number one - if you want to hook that board up to your receiver as it is intended to be used (ie, pins 0 and 1 to the receiver), then in order to upload your own sketches to it via it's on-board USB port, you will have to disconnect the RC receiver from those pins -before- you do so. What this means is that you can't use the USB port -and- have the RC receiver connected at the same time. The main reasons for this is: If the receiver is on, you would likely get garbage sent to the bootloader when you tried to upload your sketch; furthermore (and more likely), you might damage your RC receiver when you uploaded a sketch because you would be driving the receiver's -outputs- with the HIGH/LOW signals from the serial converter, which would be a bad thing.
This is pretty standard fare whenever you code on the Arduino; if you need those extra two pins, you can use them, but you can't use the USB if you have something connected to them.
So - for the WildThumper board, what do you do if you want to use USB -and- use the RC receiver? Move the receiver pins to other pins! Note in the quote above, it reads:
If you have spare I/O pins then you can redefine "RCleft" and "RCright" in the "IOpins.h" tab of the sample code.
If you look in IOpins.h (I have it here open in front of me), you'll see that RCleft is defined as "0" (digital pin 0) and RCright is defined as "1" (digital pin 1); those are the two pins as currently defined. What you would need to do is instead use a couple of the "servo output" pins as "input" instead; you could either define outputs 0 and 1 for the inputs, or outputs 5 and 6, or some other combination (whatever you are comfortable with); just know that you can't use those headers on the WT board for servos any more, only for the R/C input (you could do you debugging this way, then switch it back later, too). So, for instance, IOPins.h could be modified like follows:
#define LmotorA 3 // Left motor H bridge, input A
#define LmotorB 11 // Left motor H bridge, input B
#define RmotorA 5 // Right motor H bridge, input A
#define RmotorB 6 // Right motor H bridge, input B
#define RCleft 2 // Taking over servo 0 for RC receiver input
#define RCright 4 // Taking over servo 1 for RC receiver input
//#define S0 2 // Servo output 00 - NO LONGER AVAILABLE
//#define S1 4 // Servo output 01 - NO LONGER AVAILABLE
#define S2 7 // Servo output 02
#define S3 8 // Servo output 03
#define S4 9 // Servo output 04
#define S5 10 // Servo output 05
#define S6 12 // Servo output 06
#define A1 1 // Analog input 01
#define A2 2 // Analog input 02
#define A3 3 // Analog input 03
#define A4 4 // Analog input 04
#define A5 5 // Analog input 05
#define Battery 0 // Analog input 00
#define RmotorC 6 // Analog input 06
#define LmotorC 7 // Analog input 07
#define Charger 13 // Low=ON High=OFF
...and that modification would now use servo pin 0 (digital pin 2) for RCleft and servo pin 1 (digital pin 4) for RCright, and you would connect your receiver to those pins instead. Does that make sense?