RC Controller V2.0 and V2.1 Code

Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • #1665
    RC Tractor Guy
    Keymaster

    If you have any questions about the code then you can ask here. Also if you have any updates that I can include in the library to benefit everyone then you can also let me know here.

    #1675
    GastonLagaffe
    Participant

    Salut,
    I cannot see any link to download the software. I registered and logged in but did not help

    Ciao, Mathias

    #1677
    RC Tractor Guy
    Keymaster

    Hi,

    I see I linked to the wrong folder on the download page, I’ve fixed that now.

    Here is a direct link to the zip folder which should allow you to download it: http://rctractorguy.com/wp-content/uploads/2016/05/RCTractorControllerV2.zip

    #1678
    GastonLagaffe
    Participant

    Salut,
    thanks for the link. Unfortunately arduinoIDE 1.6.8 seems not to like the mega pro as it is not able to upload to that board. As I use UECIDE (uecide.org) I was able to upload the sketch using that more flexible IDE.

    WOuld it be possible that you publish the schematics for the controller? I am using a ITEAD 2.4 shield and I need to adjust the code to match this TFT driver.

    Ciao, Mathias

    #1679
    GastonLagaffe
    Participant

    Salut,
    the code has some problems:
    – RCTractorControllerAdafruit_TFTLCD.cpp – on lines 24 and 25 you define the screen size to be 480×320, changed back to 240×320 for 2.4″ TFT
    – RCTractorControllerV2.cpp – on line 988 you hard-code the rotation to 2 (most likely due to the large screen you used), changed back to 0

    Encoder Left_1 and Right_1 work ok
    All buttons work as expected.

    The touch function is not (yet) working: it is upside down and it states: “Unknown controller”. It reads the y-position but not the x-position. Will need to investigate if this is related to the large LCD settings

    Ciao, Mathias

    • This reply was modified 7 years, 11 months ago by GastonLagaffe. Reason: error on joystick resolved
    #1683
    RC Tractor Guy
    Keymaster

    That is annoying I am using 1.6.6, I’ll have to test with 1.6.8 when I get a chance. I hadn’t heard of UECIDE before, it looks good.

    I have uploaded a schematic to the site now, here is a link: http://rctractorguy.com/wp-content/uploads/2016/05/RC_Controller_mini_mega.pdf

    The rotation was set to 2 for the R61520 driver which seems to be upside down, I previously used an S6D0154 driver screen and the rotation had to be set to 0 for that one.

    Yes I didn’t figure out how to get the touchscreen working, the upside down screen will be because on line 5989 of RCTractorControllerV2.cpp the code I was working from sets the screen rotation to 2 again.

    Thanks for the input on the code.

    #1688
    Nishitoku
    Participant

    Hi,
    just got that new controller with the mega mini pro and the 2.4″ TFT. Beautiful thing! Great work.
    I ran into a problem with code, though.
    I tried to compile and upload the v2.1 code but got 2 errors.
    – glcdfont.c missing
    – “registers.h” missing
    I got the glcdfont.c from the Ardafruit GFX Lib. The registers.h from somewhere.

    The program compiles with the 2 files but the TFT does not initialize.(Only backlight)

    Have the registers.h or the glcdfont.c specific files and where to get them?

    Im thankful for all suggestions 🙂

    #1689
    GastonLagaffe
    Participant

    Salut,
    I copied the glcdfont.c file from the library Adafruit_GFX adn the registers.h from Adafruit_TFTLCD and this worked on my controller.
    Did you get the TFT with the kit or did you use your own? I got my own TFT from previous projects and had ti adjust the driver.

    You can test the TFT directly by running the examples in the Adafruit_TFTLCD library.

    Ciao, Mathias

    • This reply was modified 7 years, 10 months ago by GastonLagaffe.
    #1694
    RC Tractor Guy
    Keymaster

    Thanks for letting me know about the missing files, I’ve added them into an updated version of the library. I think it will solve your screen not working issue, your screen has the R61526 driver and ID is 0x1520 I think. I also fixed the screen rotation issue discussed earlier and added driver IDs 0x9328, 0x6809 and 0x9335. Here is the new version of the library.

    #1697
    Nishitoku
    Participant

    Thanks, guys! With the new Version it works fine.
    Perfekt.
    Thx again 🙂

    #1751
    John360
    Participant

    Just tested the controller for the first time, something needs improvements, I don’t know if it’s me but 1 or 2 menus make the programme block and another pair doesn’t work really well.
    But the first thing I noticed is the screen was upside down :), so I added the screen id 9341 to set rotation “2” (there was another one).
    I don’t know if the touchscreen should work but mine doesn’t.
    Maybe there should be a repository with the code and all instructions to make it work, so people can contribute to make it even better and better.
    I never did something like that and I study Java, not C++ but maybe I could do something to help.

    #1940
    RC Tractor Guy
    Keymaster

    Hi Giovanni,

    Some of the menus aren’t finished so they might freeze. I have been very busy for the last few weeks so haven’t had much time to work on the controller or the tractor code for that matter. I didn’t do any coding on for the touch screens yet so they aren’t implemented in any menus. Yes I had been hoping people would be able to contribute to the code but I had hoped to get the time to explain it better and do some commenting in the libraries.

    #3573
    ironworker221
    Participant

    Im using a L298N with an aurduino uno, trying to run two dc motors with a joystick, can anyone tell me what is wrong with the code i am using.Would like to run one motor on the x axis and one motor on the y axis.

    // Motor A

    int enA = 9;
    int in1 = 8;
    int in2 = 7;

    // Motor B

    int enB = 3;
    int in3 = 5;
    int in4 = 4;

    // Joystick Input

    int joyVert = A0; // Vertical
    int joyHorz = A1; // Horizontal

    // Motor Speed Values – Start at zero

    int MotorSpeed1 = 0;
    int MotorSpeed2 = 0;

    // Joystick Values – Start at 512 (middle position)

    int joyposVert = 512;
    int joyposHorz = 512;

    void setup()

    {

    // Set all the motor control pins to outputs

    pinMode(enA, OUTPUT);
    pinMode(enB, OUTPUT);
    pinMode(in1, OUTPUT);
    pinMode(in2, OUTPUT);
    pinMode(in3, OUTPUT);
    pinMode(in4, OUTPUT);

    // Start with motors disabled and direction forward

    // Motor A

    digitalWrite(enA, LOW);
    digitalWrite(in1, HIGH);
    digitalWrite(in2, LOW);

    // Motor B

    digitalWrite(enB, LOW);
    digitalWrite(in3, HIGH);
    digitalWrite(in4, LOW);

    }

    void loop() {

    // Read the Joystick X and Y positions

    joyposVert = analogRead(joyVert);
    joyposHorz = analogRead(joyHorz);

    // Determine if this is a forward or backward motion
    // Do this by reading the Verticle Value
    // Apply results to MotorSpeed and to Direction

    if (joyposVert < 460)

    // This is Backward

    // Set Motor A backward

    digitalWrite(in1, LOW);
    digitalWrite(in2, HIGH);

    // Set Motor B backward

    if (joyposHorz < 460)
    {

    digitalWrite(in3, HIGH);
    digitalWrite(in4, LOW);

    //Determine Motor Speeds

    // As we are going backwards we need to reverse readings

    joyposVert = joyposVert – 460; // This produces a negative number
    joyposVert = joyposVert * -1; // Make the number positive

    joyposHorz = joyposHorz – 460; // This produces a negative number
    joyposHorz = joyposHorz * -1; // Make the number positive

    MotorSpeed1 = map(joyposVert, 0, 460, 0, 255);
    MotorSpeed2 = map(joyposHorz, 0, 460, 0, 255);

    }
    else if (joyposVert > 564)
    {
    // This is Forward

    // Set Motor A forward

    digitalWrite(in1, HIGH);
    digitalWrite(in2, LOW);

    // Set Motor B forward

    }
    else if (joyposHorz > 564)
    {

    digitalWrite(in3, LOW);
    digitalWrite(in4, HIGH);

    //Determine Motor Speeds

    MotorSpeed1 = map(joyposVert, 564, 1023, 0, 255);
    MotorSpeed2 = map(joyposHorz, 564, 1023, 0, 255);

    }
    else
    {
    // This is Stopped

    MotorSpeed1 = 0;
    MotorSpeed2 = 0;

    }

    if (MotorSpeed1 < 8)MotorSpeed1 = 0;
    if (MotorSpeed2 < 8)MotorSpeed2 = 0;

    // Set the motor speeds

    analogWrite(enA, MotorSpeed1);
    analogWrite(enB, MotorSpeed2);

    }

Viewing 13 posts - 1 through 13 (of 13 total)

You must be logged in to reply to this topic.