This is the code for V2.0 and V2.1 of my RC controller design. The controller is based on an Meduino Mega so you need to choose Arduino Mega 2560 in the tools sections of the Arduino IDE when you are ready to upload. This controller has a lot of functions and as a result the software is quite complicated but if you need to know how to do something, want me to add a feature or want to contribute to the software then share you suggestion in the forum below, another user might have already done it.
This code should work with my RC vehicle library which can be found here.
A schematic for the controller can be found here. It may be useful if you are modifying the code.
RC Tractor Guy V2 Controller Library V1.03
Click here to download the RC Tractor Guy V2 Controller Library V1.03
Changes
Known Issues
Requested Upgrades
| Contributors The RC Tractor Guy Modelleicher |
RC Tractor Guy V2 Controller Library V1.02
Click here to download the RC Tractor Guy V2 Controller Library V1.02
Changes
Known Issues
Requested Upgrades
| Contributors The RC Tractor Guy |
RC Tractor Guy V2 Controller Library V1.01
Click here to download the RC Tractor Guy V2 Controller Library V1.01
Changes
Known Issues
Requested Upgrades
| Contributors The RC Tractor Guy |
RC Tractor Guy V2 Controller Library V1.00
Click here to download the RC Tractor Guy V2 Controller Library V1.00
Known Issues
Requested Upgrades
| Contributors The RC Tractor Guy |
Testing the Controller
When you have finished assembling your controller the first to do is head to the Tools section and use the tools to test the joysticks, encoders and buttons to make sure everything is connected correctly.
There is a tool for testing the NRF24 radio modules, it just outputs the raw values at the minute.
I haven’t figured out how to do XBee tests yet. You need to send “+++” to the XBee, wait for it to send “OK” back and then you can use the AT commands to get information from the XBee including received signal strength.
Questions and Suggestions
If you have any questions or suggestions then take a look at the discussion on the forum. It’s possible your question has been asked or someone else has already dealt with your problem.
How to select V2.0 or V2.1 in the code
At the top of the controller example code you will see a line of code initialising the controller library. In the brackets you will see a number which specifies the version of controller you are programming. This will tell the code how your controller is wired.
If you have a V2.0 controller your code should read:Â RCTractorControllerV2 RCTC(20);
If you have a V2.1 controller your code should read:Â RCTractorControllerV2 RCTC(21);
Screen Trouble
The screens are cheap because they are surplus stock which the chinese manufacturers are making use of with hobbyists. The downside is that there are a lot of drivers which can make things a little tricky.
If your screen is blank then it is likely that the Arduino is having trouble selecting the correct driver. You can do so manually by going into the library folder, right clicking RCTractorControllerV2.cpp and selecting edit. This will open the library file in a text editor. Push ctrl and the f key on your keyboard together to bring up the find function in the editor, type identifies in the search box and push find next until you see the following code.
identifier = tft.readID();
// If TFT doesn’t work try commenting out the above line and trying each of the following one by one
//identifier = 0x9325;
//identifier = 0x9328;
//identifier = 0x7575;
//identifier = 0x8357;
//identifier = 0x9341;
//identifier = 0x9327;
//identifier = 0x0154;
//identifier = 0x9488;
//identifier = 0x9329;
//identifier = 0x1520;
if (identifier == 0x00D3 || identifier == 0xD3D3) identifier = 0x9481; // write-only shield
if (identifier == 0xFFFF) identifier = 0x9341; // serial
//identifier = 0x9329; // force ID
tft.begin(identifier);
You can manually go through each of the drivers here by uncommenting each identifier one at a time by deleting the // symbol. For example “//identifier = 0x9325;” is commented out of the code and “identifier = 0x9325;” is uncommented.
If that doesn’t solve the problem then the best thing to do is install the library found here and upload the graphictest_kbv example to an UNO. Open the serial monitor and you should see the driver ID will be displayed in the text, once you have this information send me an email and I’ll try to get it working in the controller code.