Go Down

Topic: Adding R/C Transmitter To My Controls... (Read 451 times) previous topic - next topic

jgreene33

     Hello,
I am trying to add the joysticks from an old 72mhz transmitter. I added 2 pix.
The problem I am having is when I get it plugged in to my Mega. The range is tiny.
I am thinking its the fact the the pots are different. If I remember correctly they are
50k. Here is the code I am running transmit side:

Code: [Select]
//-------------------------------------------------------------HC-12 Send

#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <Servo.h>
Servo Myservo;
LiquidCrystal_I2C lcd(0x3F, 16, 2);
int AnalogInputPin = A5;
int AnalogInputPin2 = A6;
int OutputValue = 0;
int OutputValue2 = 0;

void setup()
{
  Serial.begin(9600);
  lcd.init();
  lcd.backlight();
  lcd.setCursor(3, 0);
  lcd.print("$$$$$$$$$$$$$");
  lcd.setCursor(0, 1);
  lcd.print("%%%%%%%%");
}

void loop()
{
  {
    int secs = millis() / 1000;
    lcd.setCursor(10, 1);
    lcd.print (secs);
  }

  {
    int AnalogInputValue = analogRead(AnalogInputPin);
    OutputValue = map(AnalogInputValue, 0, 1023, 0, 180);
    Serial.println(OutputValue);
    delay(140);
  }

 // {
   // int AnalogInputValue2 = analogRead(AnalogInputPin2);
   // OutputValue2 = map(AnalogInputValue2, 0, 1023, 180, 360);  //512
   // Serial.println(OutputValue2);
   // delay(140);
//  }
}





Thanks in advance!


Boardburner2

#1
Mar 23, 2017, 11:26 pm Last Edit: Mar 23, 2017, 11:27 pm by Boardburner2
Hello,
I am trying to add the joysticks from an old 72mhz transmitter. I added 2 pix.
The problem I am having is when I get it plugged in to my Mega. The range is tiny.
I am thinking its the fact the the pots are different. If I remember correctly they are
50k. Here is the code I am running transmit side:

Code: [Select]
//-------------------------------------------------------------HC-12 Send

#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <Servo.h>
Servo Myservo;
LiquidCrystal_I2C lcd(0x3F, 16, 2);
int AnalogInputPin = A5;
int AnalogInputPin2 = A6;
int OutputValue = 0;
int OutputValue2 = 0;

void setup()
{
  Serial.begin(9600);
  lcd.init();
  lcd.backlight();
  lcd.setCursor(3, 0);
  lcd.print("$$$$$$$$$$$$$");
  lcd.setCursor(0, 1);
  lcd.print("%%%%%%%%");
}

void loop()
{
  {
    int secs = millis() / 1000;
    lcd.setCursor(10, 1);
    lcd.print (secs);
  }

  {
    int AnalogInputValue = analogRead(AnalogInputPin);
    OutputValue = map(AnalogInputValue, 0, 1023, 0, 180);
    Serial.println(OutputValue);
    delay(140);
  }

 // {
   // int AnalogInputValue2 = analogRead(AnalogInputPin2);
   // OutputValue2 = map(AnalogInputValue2, 0, 1023, 180, 360);  //512
   // Serial.println(OutputValue2);
   // delay(140);
//  }
}





Thanks in advance!


Find out the resistance of your joystics with a DMM.
The movement of the sticks will only be a small proportion of the total movement of th pot's.

jgreene33

#2
Mar 23, 2017, 11:39 pm Last Edit: Mar 23, 2017, 11:52 pm by jgreene33
1.3 - 4.2k Serial Monitor says : 43 - 147 Thanks!

jgreene33

Perhaps the range is limited due to the trim tabs? I got the Serial output down to 12 by adjusting one of them.

Power_Broker

Perhaps the range is limited due to the trim tabs? I got the Serial output down to 12 by adjusting one of them.
Yup, you guessed it.
"The desire that guides me in all I do is the desire to harness the forces of nature to the service of mankind."
   - Nikola Tesla

jgreene33


Go Up