Topic: 'BluetoothSerial' was not declared in this scope
I got error that RemoteXY/src/RemoteXYStream_BluetoothSerial.h:13:5: error: 'BluetoothSerial' was not declared in this scope
I use esp32 with bluetooth classic
You are not logged in. Please login or register.
RemoteXY community → Issues and Errors → 'BluetoothSerial' was not declared in this scope
I got error that RemoteXY/src/RemoteXYStream_BluetoothSerial.h:13:5: error: 'BluetoothSerial' was not declared in this scope
I use esp32 with bluetooth classic
Please share the complete code.
What version of the ESP32 library are you using? 2.x.x or 3.x.x?
I use esp32 version 2.0.14 / Arduino IDE 2.3.2
Success ran on Windows but on Linux found error both arduino ide 1.8.19 and 2.3.2
(Linux is Zorin Os 17)
THis is the code
//////////////////////////////////////////////
// RemoteXY include library //
//////////////////////////////////////////////
// you can enable debug logging to Serial at 115200
//#define REMOTEXY__DEBUGLOG
// RemoteXY select connection mode and include library
#define REMOTEXY_MODE__ESP32CORE_BLUETOOTH
#include <BluetoothSerial.h>
// RemoteXY connection settings
#define REMOTEXY_BLUETOOTH_NAME "onebotic2"
#include <RemoteXY.h>
// RemoteXY configurate
#pragma pack(push, 1)
uint8_t RemoteXY_CONF[] = // 143 bytes
{ 255,4,0,7,0,136,0,17,0,0,0,31,1,106,200,1,1,9,0,130,
255,255,108,203,0,8,5,25,129,56,56,0,19,25,31,71,15,20,77,77,
56,0,19,19,125,0,0,0,0,0,0,200,66,0,0,160,65,0,0,32,
65,0,0,0,64,19,0,2,9,89,32,16,0,19,26,8,8,79,78,0,
79,70,70,0,129,16,110,17,6,19,76,73,71,72,84,0,129,60,110,31,
6,19,67,85,84,32,83,80,69,69,68,0,4,54,91,47,11,128,19,0,
129,3,5,55,9,19,79,78,69,66,79,84,73,67,45,50,0,65,93,4,
9,9,112 };
// this structure defines all the variables and events of your control interface
struct {
// input variables
int8_t joy_main_x; // from -100 to 100}
int8_t joy_main_y; // from -100 to 100}
uint8_t btn_light; // =1 if switch ON and =0 if OFF
int8_t sld_cutspeed; // =0..100 slider position
// output variables
float meter_speed; // from 0 to 100
uint8_t led_red; // =0..255 LED Red brightness
uint8_t led_green; // =0..255 LED Green brightness
uint8_t led_blue; // =0..255 LED Green brightness
// other variable
uint8_t connect_flag; // =1 if wire connected, else =0
} RemoteXY;
#pragma pack(pop)
/////////////////////////////////////////////
// END RemoteXY include //
/////////////////////////////////////////////
void setup()
{
RemoteXY_Init ();
Serial.begin(115200);
// TODO you setup code
}
void loop()
{
RemoteXY_Handler ();
RemoteXY.meter_speed = sqrt(0.95*RemoteXY.joy_main_y*RemoteXY.joy_main_y+0.3*RemoteXY.joy_main_x*RemoteXY.joy_main_x);
Serial.print(RemoteXY.joy_main_x);
Serial.print(" ");
Serial.print(RemoteXY.joy_main_y);
Serial.print(" ");
Serial.println(RemoteXY.meter_speed);
// TODO you loop code
// use the RemoteXY structure for data transfer
// do not call delay(), use instead RemoteXY_delay()
}
I use esp32 version 2.0.14 / Arduino IDE 2.3.2
Success ran on Windows but on Linux found error both arduino ide 1.8.19 and 2.3.2
(Linux is Zorin Os 17)
THis is the code
//////////////////////////////////////////////
// RemoteXY include library //
//////////////////////////////////////////////
// you can enable debug logging to Serial at 115200
//#define REMOTEXY__DEBUGLOG
// RemoteXY select connection mode and include library
#define REMOTEXY_MODE__ESP32CORE_BLUETOOTH
#include <BluetoothSerial.h>
// RemoteXY connection settings
#define REMOTEXY_BLUETOOTH_NAME "onebotic2"
#include <RemoteXY.h>
// RemoteXY configurate
#pragma pack(push, 1)
uint8_t RemoteXY_CONF[] = // 143 bytes
{ 255,4,0,7,0,136,0,17,0,0,0,31,1,106,200,1,1,9,0,130,
255,255,108,203,0,8,5,25,129,56,56,0,19,25,31,71,15,20,77,77,
56,0,19,19,125,0,0,0,0,0,0,200,66,0,0,160,65,0,0,32,
65,0,0,0,64,19,0,2,9,89,32,16,0,19,26,8,8,79,78,0,
79,70,70,0,129,16,110,17,6,19,76,73,71,72,84,0,129,60,110,31,
6,19,67,85,84,32,83,80,69,69,68,0,4,54,91,47,11,128,19,0,
129,3,5,55,9,19,79,78,69,66,79,84,73,67,45,50,0,65,93,4,
9,9,112 };
// this structure defines all the variables and events of your control interface
struct {
// input variables
int8_t joy_main_x; // from -100 to 100}
int8_t joy_main_y; // from -100 to 100}
uint8_t btn_light; // =1 if switch ON and =0 if OFF
int8_t sld_cutspeed; // =0..100 slider position
// output variables
float meter_speed; // from 0 to 100
uint8_t led_red; // =0..255 LED Red brightness
uint8_t led_green; // =0..255 LED Green brightness
uint8_t led_blue; // =0..255 LED Green brightness
// other variable
uint8_t connect_flag; // =1 if wire connected, else =0
} RemoteXY;
#pragma pack(pop)
/////////////////////////////////////////////
// END RemoteXY include //
/////////////////////////////////////////////
void setup()
{
RemoteXY_Init ();
Serial.begin(115200);
// TODO you setup code
}
void loop()
{
RemoteXY_Handler ();
RemoteXY.meter_speed = sqrt(0.95*RemoteXY.joy_main_y*RemoteXY.joy_main_y+0.3*RemoteXY.joy_main_x*RemoteXY.joy_main_x);
Serial.print(RemoteXY.joy_main_x);
Serial.print(" ");
Serial.print(RemoteXY.joy_main_y);
Serial.print(" ");
Serial.println(RemoteXY.meter_speed);
// TODO you loop code
// use the RemoteXY structure for data transfer
// do not call delay(), use instead RemoteXY_delay()
}
There is some conflict with other library, Just delete arduino and all library and install new one. The problem gone
RemoteXY community → Issues and Errors → 'BluetoothSerial' was not declared in this scope
Powered by PunBB, supported by Informer Technologies, Inc.