Skip to content

Instantly share code, notes, and snippets.

@ymt117
Last active June 4, 2025 14:07
Show Gist options
  • Save ymt117/3da6cadcd5c4c1253f7f53835794afbb to your computer and use it in GitHub Desktop.
Save ymt117/3da6cadcd5c4c1253f7f53835794afbb to your computer and use it in GitHub Desktop.
Yawの値を変化させる
#include "sbus.h"
#include <HardwareSerial.h>
HardwareSerial hs(0);
bfs::SbusRx sbus_rx(&hs, 20, 21, false);
bfs::SbusTx sbus_tx(&hs, 20, 21, false);
bfs::SbusData data;
void setup() {
sbus_rx.Begin();
sbus_tx.Begin();
}
void loop() {
// 任意のRC値(1000〜2000)を送信
data.ch[0] = 1500; // Roll
data.ch[1] = 1500; // Pitch
data.ch[2] = 1000; // Throttle
data.ch[3] = 1500; // Yaw
sbus_tx.data(data);
sbus_tx.Write();
delay(1000);
data.ch[0] = 1500;
data.ch[1] = 1500;
data.ch[2] = 1000;
data.ch[3] = 1000; // Yawのチャンネルの値を変更する
sbus_tx.data(data);
sbus_tx.Write();
delay(1000);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment