- This topic has 12 replies, 5 voices, and was last updated 6 years, 3 months ago by ironworker221.
- AuthorPosts
- May 14, 2016 at 12:38 pm #1665RC Tractor GuyKeymaster
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.
May 15, 2016 at 5:45 pm #1675GastonLagaffeParticipantSalut,
I cannot see any link to download the software. I registered and logged in but did not helpCiao, Mathias
May 15, 2016 at 6:32 pm #1677RC Tractor GuyKeymasterHi,
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
May 16, 2016 at 10:31 am #1678GastonLagaffeParticipantSalut,
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
May 16, 2016 at 11:49 am #1679GastonLagaffeParticipantSalut,
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 0Encoder 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
May 16, 2016 at 1:05 pm #1683RC Tractor GuyKeymasterThat 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.
May 25, 2016 at 8:45 pm #1688NishitokuParticipantHi,
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 🙂
May 25, 2016 at 9:25 pm #1689GastonLagaffeParticipantSalut,
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, 11 months ago by GastonLagaffe.
May 26, 2016 at 5:19 pm #1694RC Tractor GuyKeymasterThanks 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.
May 26, 2016 at 6:12 pm #1697NishitokuParticipantThanks, guys! With the new Version it works fine.
Perfekt.
Thx again 🙂July 19, 2016 at 3:38 pm #1751John360ParticipantJust 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.August 21, 2016 at 10:43 am #1940RC Tractor GuyKeymasterHi 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.
January 8, 2018 at 7:03 pm #3573ironworker221ParticipantIm 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 Directionif (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 positivejoyposHorz = joyposHorz – 460; // This produces a negative number
joyposHorz = joyposHorz * -1; // Make the number positiveMotorSpeed1 = 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 StoppedMotorSpeed1 = 0;
MotorSpeed2 = 0;}
if (MotorSpeed1 < 8)MotorSpeed1 = 0;
if (MotorSpeed2 < 8)MotorSpeed2 = 0;// Set the motor speeds
analogWrite(enA, MotorSpeed1);
analogWrite(enB, MotorSpeed2);}
- AuthorPosts
You must be logged in to reply to this topic.