Sbus
Arduino library for SBUS (Futaba)
Install / Use
/learn @fdivitto/SbusREADME
Arduino library for SBUS (Futaba)
SBUS library supports synchronous (blocking) or asynchronous (non-blocking) decoding of Futaba SBUS without requiring a TTL inverter.
SBUS uses the TIMER 2 and the Pin Change interrupt. It doesn't use UARTs, so those pins can be used:
Arduino Uno/Nano/Mini: All pins are usable
Arduino Mega: 10, 11, 12, 13, 50, 51, 52, 53, A8 (62), A9 (63), A10 (64),
A11 (65), A12 (66), A13 (67), A14 (68), A15 (69)
Arduino Leonardo/Micro: 8, 9, 10, 11, 14 (MISO), 15 (SCK), 16 (MOSI)
HoodLoader2: All (broken out 1-7) pins are usable
Attiny 24/44/84: All pins are usable
Attiny 25/45/85: All pins are usable
Attiny 13: All pins are usable
Attiny 441/841: All pins are usable
ATmega644P/ATmega1284P: All pins are usable
Does not require a TTL inverter.
Non blocking mode usage:
SBUS sbus;
void setup() {
sbus.begin(3, sbusNonBlocking); // use pin 3
}
void loop() {
uint16_t channel_1 = sbus.getChannel(1);
uint16_t channel_2 = sbus.getChannel(2);
...etc...
}
sbus.getChannel() gets the channel number (1..18) and returns the channel value in the range 988..2012 (cleanflight friendly). Non blocking mode generates an interrupt for every received byte. It may miss some frames if other interrupts delay pin change detection. Non blocking mode is more CPU intensive, because every frame is catched, even it is not actually used.
Blocking usage:
SBUS sbus;
void setup() {
sbus.begin(3, sbusBlocking); // use pin 3
}
void loop() {
if (sbus.waitFrame()) {
uint16_t channel_1 = sbus.getChannel(1);
uint16_t channel_2 = sbus.getChannel(2);
...etc...
}
}
sbus.waitFrame() needs to be called. It returns "false" on timeout (default is 2 seconds). sbus.waitFrame() waits for the next frame the returns.
Related Skills
node-connect
344.1kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
96.8kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
344.1kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
344.1kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
