Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
changlin1990 opened this issue Jun 12, 2023 · 11 comments
Open

Comments

@changlin1990
Copy link

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

@flybrianfly
Copy link
Contributor

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.

@changlin1990
Copy link
Author

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

@changlin1990
Copy link
Author

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

@flybrianfly
Copy link
Contributor

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

@changlin1990
Copy link
Author

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

OK, thank you. I'll try again.

@changlin1990
Copy link
Author

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

@Rytiggy
Copy link

Rytiggy commented Jan 4, 2024

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
Copy link

Rytiggy commented Jan 4, 2024

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

@lsors
Copy link

lsors commented Jan 21, 2024

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

@iurycarlos
Copy link

are you using a 5 to 3.3v converter?

@Witty-Wizard
Copy link

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

Try using this library

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants