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

Unable to complile code for ESP32. #440

Closed
Getafix17 opened this issue Jul 1, 2024 · 1 comment
Closed

Unable to complile code for ESP32. #440

Getafix17 opened this issue Jul 1, 2024 · 1 comment
Labels
help wanted Extra attention is needed

Comments

@Getafix17
Copy link

I successfully compiled and uploaded the code to an Arduino Nano; however,, I am struggling to compile the code to ESP32.
I have included all the necessary libraries for ESP32 and BLE. I will be using an L298n an Android phone and a ESP32.
Perhaps I missed something.
My config for ESP32 in Arduino IDE:
//MCUs
#define NANO 328 //Atmega328p
#define ESP32 32 //ESP32

//Robot bodies with Atmega328p as MCU --> Select Arduino Nano as board
#define DIY 0 // DIY without PCB
#define PCB_V1 1 // DIY with PCB V1
#define PCB_V2 2 // DIY with PCB V2
#define RTR_TT 3 // Ready-to-Run with TT-motors
#define RC_CAR 4 // RC truck prototypes
#define LITE 5 // Smaller DIY version for education
//Robot bodies with ESP32 as MCU --> Select ESP32 Dev Module as board
#define RTR_TT2 6 // Ready-to-Run with TT-motors
#define RTR_520 7 // Ready-to-Run with 520-motors
#define MTV 8 // Multi Terrain Vehicle
#define DIY_ESP32 9 // DIY without PCB

//------------------------------------------------------//
// SETUP - Choose your body
//------------------------------------------------------//

// Setup the OpenBot version (DIY, PCB_V1, PCB_V2, RTR_TT, RC_CAR, LITE, RTR_TT2, RTR_520, DIY_ESP32,OPENBOT DIY)
#define OPENBOT DIY_ESP32

SETTINGS - Global settings
//------------------------------------------------------//

// Enable/Disable no phone mode (1,0)
// In no phone mode:
// - the motors will turn at 75% speed
// - the speed will be reduced if an obstacle is detected by the sonar sensor
// - the car will turn, if an obstacle is detected within TURN_DISTANCE
// WARNING: If the sonar sensor is not setup, the car will go full speed forward!
#define NO_PHONE_MODE 1

// Enable/Disable debug print (1,0)
#define DEBUG 1

// Enable/Disable coast mode (1,0)
// When no control is applied, the robot will either coast (1) or actively stop (0)
boolean coast_mode = 0;

My snippet for DIY ESP32
//-------------------------DIY_ESP32----------------------//
#elif (OPENBOT == DIY_ESP32)
const String robot_type = "DIY_ESP32";
#define MCU ESP32
#include <esp_wifi.h>
#define HAS_BLUETOOTH 1
#define analogWrite ledcWrite
#define attachPinChangeInterrupt attachInterrupt
#define detachPinChangeInterrupt detachInterrupt
#define digitalPinToPinChangeInterrupt digitalPinToInterrupt
#define PIN_PWM_L1 CH_PWM_L1
#define PIN_PWM_L2 CH_PWM_L2
#define PIN_PWM_R1 CH_PWM_R1
#define PIN_PWM_R2 CH_PWM_R2
#define HAS_VOLTAGE_DIVIDER 0
const float VOLTAGE_DIVIDER_FACTOR = (30 + 10) / 10;
const float VOLTAGE_MIN = 6.0f;
const float VOLTAGE_LOW = 9.0f;
const float VOLTAGE_MAX = 12.6f;
const float ADC_FACTOR = 3.3 / 4095;
#define HAS_INDICATORS 0
#define HAS_SONAR 0
#define SONAR_MEDIAN 0
#define HAS_SPEED_SENSORS_FRONT 0
//PWM properties
const int FREQ = 5000;
const int RES = 8;
const int CH_PWM_L1 = 0;
const int CH_PWM_L2 = 1;
const int CH_PWM_R1 = 2;
const int CH_PWM_R2 = 3;
const int PIN_PWM_LF1 = 13;
const int PIN_PWM_LF2 = 12;
const int PIN_PWM_LB1 = 13;
const int PIN_PWM_LB2 = 12;
const int PIN_PWM_RF1 = 27;
const int PIN_PWM_RF2 = 33;
const int PIN_PWM_RB1 = 27;
const int PIN_PWM_RB2 = 33;
const int PIN_SPEED_LF = 5;
const int PIN_SPEED_RF = 18;
const int PIN_VIN = 39;
const int PIN_TRIGGER = 25;
const int PIN_ECHO = 26;
const int PIN_LED_LI = 22;
const int PIN_LED_RI = 16;
#endif

The error:
Used: C:\Users\alexf\Documents\Arduino\libraries\ESP32_BLE_Arduino
Not used: C:\Users\alexf\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.2\libraries\BLE
exit status 1
'ledcSetup' was not declared in this scope

@Getafix17 Getafix17 added the help wanted Extra attention is needed label Jul 1, 2024
@thias15
Copy link
Collaborator

thias15 commented Jul 1, 2024

Try using version 2.x of Arduino-ESP32 since there were some breaking changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants