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:
//-------------------------------------------------------------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!
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:
//-------------------------------------------------------------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.
1.3 - 4.2k Serial Monitor says : 43 - 147 Thanks!
Perhaps the range is limited due to the trim tabs? I got the Serial output down to 12 by adjusting one of them.
Thank you for confirming that!