T8S RC controller AUX Channels

Hello all please bear with me, for I am new.
I'm using a T8S RC controller to operate different functions on my Arduino. However I can't get CH7, CH5, CH6, CH8 to show any values. I need some coding help. I was able to get CH2 , and CH3 working by moving the Joysticks. They used the PWM pins. However CH5 and CH7 are three way switches, I'm not sure what to write in order to receive values for them. CH6 is a regular button and CH8 is a variable analog. I'm just not getting any values from the Channels I need.
For reference I am using this Amazon.com: Radiolink T8S 8 Channels 2.4G RC Transmitter and Receiver 8CH R8EF RX, Radio Remote Controller, Built-in Rechargeable 1S Battery for Quad Drone/Airplane/Car/Boat/Robot and More (Mode 2 Left Throttle) : Toys & Games

This is how my code looks

#define RCpin1 5 // Channel 2

#define RCpin2 3 // Channel 3

#define RCpin3 2

// Values for the Channels

unsigned long RCValue1; // Channel 2

unsigned long RCValue2; // Channel 3

int RCValue3; // Channel 7

// Output variables

int FWD1= 8;

int FWD2= 12;

int BCK1= 9;

int BCK2= 13;

void setup() {

// Starts the serial monitor, defines each pin

Serial.begin(9600);

pinMode(RCpin1,INPUT);

pinMode(RCpin2,INPUT);

pinMode(RCpin3,INPUT); // Emergency

pinMode(FWD1,OUTPUT);

pinMode(FWD2,OUTPUT);

pinMode(BCK1,OUTPUT);

pinMode(BCK2,OUTPUT);

}

void loop() {

// Reads the input signal from the reciever

RCValue1 = pulseIn(RCpin1,HIGH);

RCValue2 = pulseIn(RCpin2,HIGH);

RCValue3 = digitalRead(RCpin3);

// Emergency switch Channel CH7

Serial.print("CH3: ");

Serial.print(RCValue1);

Serial.print("| CH2: ");

Serial.print(RCValue2);

Serial.print(" Emergency Value: ");

Serial.println(RCValue3);

if(RCValue1 > 1700){

digitalWrite(FWD1, HIGH);

} else {

digitalWrite(FWD1,LOW);

}

if (RCValue1 < 1200) {

digitalWrite(BCK1, HIGH);

} else {

digitalWrite(BCK1,LOW);

}

if (RCValue2 < 1100) {

digitalWrite(FWD2, HIGH);

} else {

digitalWrite(FWD2,LOW);

}

if (RCValue2 > 1700) {

digitalWrite(BCK2, HIGH);

} else {

digitalWrite(BCK2,LOW);

}

}

maybe this youtube video might help...

also did you check your controller configuration for the AUX switches?

1 Like

Yes I've watched that video, and it helps wit the joysticks but not the buttons or switches. I'm using the app and it is able to detect when the buttons are being pressed. I tried using digitalRead() , AnalogRead(), and a pulseIN(). All of which returned zero except for pulseIN() which gave a randon number like 312 or 932

I haven't looked at the source you are cribbing, but this looks wrong

  RCValue2 = pulseIn(RCpin2, HIGH);    // OK

  RCValue3 = digitalRead(RCpin3);      // ???

The receiver is putting out pulses (PWM) on each channel, regardless of what the channel controls or how the control signal is put in.

The values will be between 1000 and 2000 typically, so for a simple switch you need to

RCValue3 = pulseIn(RCpin3, HIGH);

bool thatSwitch = RCValue3 > 1500;

to derive a useful boolean value thatSwitch, true the switch is up, false it isn't, or you could say it is down.

For a three way switch, same same. You must read the pulse width, and then derive useful variables, viz:

  RCValue4 = pulseIn(RCpin4, HIGH);

  byte threeWaySwitch;

  if (RCValue4 < 1333) threeWaySwitch = 0;
  else if (RCValue4 > 1666) threeWaySwitch = 2;
  else threeWaySwitch = 1;

so 0 will be for the switch alla way down, 1 would mean the switch is in the middle position and obvsly I hope 2 will be the value of threeWaySwitch when the switch is alla way up.

You could write

  byte threeWaySwitch = 1;  // in the middle until proven otherwise

  if (RCValue4 < 1333) threeWaySwitch = 0;
  if (RCValue4 > 1666) threeWaySwitch = 2;

or a few other ways, like a switch/case statement with ranges.

HTH

a7

If your receiver has a PPM output, or can be so configured, you might do better using that.

Look for a PPM decoder library. It should provide all the channel data with relatively little overhead, no fiddly pusleIn on your hands and knees like you do now.

Just one input pin, too, always a step on the right direction.

End to end, the PPM decoder will provide faster and more accurate reporting of sticks and pots.

You'd still need the logic I exposed earlier for you switches.

a7

Sorry for the late reply. I tried using the code that you provided however I'm still not seeing any values in that channel using the PWM mode. I see zeros.

Rule #0: Post the code.

It is hard to know what you tried exactly. It would be easy for a simple mistake or something to hang you up.

Please post a complete sketch that uses the idea I had and doesn't work.

NP. We here and some of us have lives, too. This is your project to spend time on or not.

a7