For this Im using a XM+ Receiver, I need it to read input from the Taranis X9 Lite so that it can control the Servo's movement through the Arduino Uno R3. The servo has power and is connected to pin 9 and works with other servo codes. As for the XM+, it has power and I connected the SBUS to Pin 0(RX).
#include <FrSkySBUS.h>
#include <Servo.h>
FrSkySBUS sbus;
Servo servo;
void setup() {
Serial.begin(100000); // Use 'Serial' for the Arduino Uno
sbus.begin(Serial);
servo.attach(9); // Adjust the pin number based on your setup
}
void loop() {
if (sbus.read()) {
int channelValue = sbus.readChannel(1); // Adjust the channel number as needed
int servoPosition = map(channelValue, 172, 1811, 0, 180); // Adjust the range as needed
servo.write(servoPosition);
}
}
This is the code but SBUS, SBUS2, FrSkySBUS libraries cannot be found or I do not where to look. Im wondering if anybody can assist with this. I have already binded the XM+ to the Taranis X9 Lite
Aileron (Channel 1)
Elevator (Channel 2)
Rudder (Channel 3)
Throttle (Channel 4)
I configured the controller in this way as the XM+ is using this.
I moved your topic to an appropriate forum category @timgeo.
In the future, please take some time to pick the forum category that best suits the subject of your topic. There is an "About the _____ category" topic at the top of each category that explains its purpose.
I didn't see any actual question, so assuming it "doesn't work", then @hmeijdam has reminded us of a critical detail.
"Real" FC boards that allow use of SBUS have the built-in ability to invert the signal, either before the pin at the pin in a configuration of the processor or in software.
Did you look to see if the library you are using has the ability to do the software fix?
Otherwise you will need to invert the signal before feeding it to your UNO.