sbus icon indicating copy to clipboard operation
sbus copied to clipboard

Using this library, there was an error running on esp32 arduino

Open changlin1990 opened this issue 1 year ago • 11 comments

When running esp32 on the arduino ide and using this library, an error occurred. Below is a screenshot of the error prompt. Please help identify and fix the problem. image image image

changlin1990 avatar Jun 12 '23 18:06 changlin1990

Compiles fine for me using Arduino 1.8.19, the latest version of the library downloaded directly from GitHub, and compiling for ESP32 Dev. Please confirm that you are using the latest version of the library downloaded directly from GitHub (Arduino's library manager sometimes doesn't catch version updates). If you're still encountering issues, please provide the Arduino version number and the exact board that you are compiling for as well as the version of the ESP32 board software.

flybrianfly avatar Jun 12 '23 20:06 flybrianfly

I am using the latest version, please take a screenshot, the IDE is 2.1 image

changlin1990 avatar Jun 12 '23 20:06 changlin1990

Do you have these error prompts when trying out version 2.0 of the Arduino IDE?

changlin1990 avatar Jun 12 '23 21:06 changlin1990

No, still compiles without errors or warnings. Again, recommend downloading and installing directly from GitHub rather than the builtin Arduino library manager.

Screenshot from 2023-06-12 19-19-26

flybrianfly avatar Jun 13 '23 01:06 flybrianfly

好的,谢谢,我再试一试,

OK, thank you. I'll try again.

changlin1990 avatar Jun 13 '23 01:06 changlin1990

I manually installed the latest library, but there was still an error. The error message is as follows. What are the possible reasons? image

changlin1990 avatar Jun 13 '23 17:06 changlin1990

I was able to get it to compile by using the ESP32 dev module for the board. Screenshot 2024-01-03 at 11 07 21 PM

Rytiggy avatar Jan 04 '24 04:01 Rytiggy

I was able to get this working, I only needed to use the RX input so the code chages to:

Note that I am using the RX 2 pin on the ESP 32. which is GPIO 16.

#include "sbus.h"

/* SBUS object, reading SBUS */
// bfs::SbusRx sbus_rx(&Serial2, 26, 27, 1, 1);
bfs::SbusRx sbus_rx(&Serial2, 16, 17, true);
/* SBUS object, writing SBUS */
// bfs::SbusTx sbus_tx(&Serial2, 26, 27, 1, 1);
/* SBUS data */
bfs::SbusData data;

void setup() {
  /* Serial to display data */
  Serial.begin(115200);
  while (!Serial) {}

  delay(2000);

  /* Begin the SBUS communication */
  Serial.println("Begin SBUS...");
  sbus_rx.Begin();
  // sbus_tx.Begin();
}

void loop() {

  if (sbus_rx.Read()) {
    /* Grab the received data */
    data = sbus_rx.data();
    /* Display the received data */
    for (int8_t i = 0; i < data.NUM_CH; i++) {
      Serial.print(data.ch[i]);
      Serial.print("\t");
    }
    
    /* Display lost frames and failsafe data */
    Serial.print(data.lost_frame);
    Serial.print("\t");
    Serial.println(data.failsafe);
    /* Set the SBUS TX data to the received data */
    // sbus_tx.data(data);
    /* Write the data to the servos */
    // sbus_tx.Write();
  }
}

Example

Screenshot 2024-01-04 at 6 07 20 PM

Hope this helps

Rytiggy avatar Jan 04 '24 23:01 Rytiggy

I also can work on esp32 board with Arduino IDE 2.0,but can not work for esp8266

lsors avatar Jan 21 '24 09:01 lsors

are you using a 5 to 3.3v converter?

iurycarlos avatar May 09 '24 00:05 iurycarlos

https://github.com/Witty-Wizard/SerialIO

Try using this library

Witty-Wizard avatar Jul 02 '24 04:07 Witty-Wizard