bolderflight / sbus

Arduino and CMake library for communicating with SBUS receivers and servos.
MIT License
373 stars 132 forks source link

ESP32 Compilation Error #66

Closed Dr-Drone closed 1 year ago

Dr-Drone commented 1 year ago

Hi, I'm trying to compile for ESP32 s2 and use pin 14 as SBUS input to display sbus output. I'm using the sbus_example script as is and it isn't working. Any help would be greatly appreciated. Thanks!

Error: sbus_example.ino:30:22: error: 'Serial2' was not declared in this scope bfs::SbusRx sbus_rx(&Serial2); ^~~

flybrianfly commented 1 year ago

Looks like ESP32 doesn't have Serial2. You need to pass the correct Serial bus to the SBUS constructor. Also, please review the library documentation for ESP32. You'll see that the constructor for ESP32 requires the pointer to the serial bus object along with the pin numbers and a boolean specifying whether to use an inverted SBUS signal.

Dr-Drone commented 1 year ago

Thanks a lot! Got it to work. Had to use 3.3v to power RX (3.3v logic) and updated the following for the esp32 s2 mini

include "sbus.h"

include

HardwareSerial SBUSS(1);

/ SBUS object, reading SBUS / bfs::SbusRx sbus_rx(&SBUSS, 14, 15, true); / SBUS object, writing SBUS / bfs::SbusTx sbus_tx(&SBUSS, 14, 15, true); / SBUS data / bfs::SbusData data;