The Blynk library currently supports Wifi & BLE on ESP32. Bluetooth Classic is however not yet supported.
So I developped it.
To be able to use it you need up-to-date
ESP32 libraries, if not it will not compile
Android app: version 2.26.5 (which is unfortunately not yet available, but will include the necessary fixes in the Bluetooth implementation).
Feel free to add it to the library.
/*************************************************************
Download latest Blynk library here:
https://github.com/blynkkk/blynk-library/releases/latest
Blynk is a platform with iOS and Android apps to control
Arduino, Raspberry Pi and the likes over the Internet.
You can easily build graphic interfaces for all your
projects by simply dragging and dropping widgets.
Downloads, docs, tutorials: http://www.blynk.cc
Sketch generator: http://examples.blynk.cc
Blynk community: http://community.blynk.cc
Social networks: http://www.fb.com/blynkapp
http://twitter.com/blynk_app
Blynk library is licensed under MIT license
This example code is in public domain.
*************************************************************
This example shows how to use ESP32 BT
This file has been truncated. show original
2 Likes
Gunner
July 21, 2018, 6:37am
3
I tried to give this a look… but I seem to have some undeclared variable errors.
What precisely do you mean when you say
I have up-to-date GIT based Arduino Core for ESP32 installed.
I initially just copied the BlynkSimpleEsp32_BT.h
into Blynk’s existing library folder…
Compiling sketch...
"D:\Users\Gunner\Documents\Arduino\hardware\espressif\esp32/tools/xtensa-esp32-elf/bin/xtensa-esp32-elf-g++" -DESP_PLATFORM -DMBEDTLS_CONFIG_FILE="mbedtls/esp_config.h" -DHAVE_CONFIG_H "-ID:\Users\Gunner\Documents\Arduino\hardware\espressif\esp32/tools/sdk/include/config" "-ID:\Users\Gunner\Documents\Arduino\hardware\espressif\esp32/tools/sdk/include/bluedroid" "-ID:\Users\Gunner\Documents\Arduino\hardware\espressif\esp32/tools/sdk/include/app_trace" "-ID:\Users\Gunner\Documents\Arduino\hardware\espressif\esp32/tools/sdk/include/app_update" "-ID:\Users\Gunner\Documents\Arduino\hardware\espressif\esp32/tools/sdk/include/bootloader_support" "-ID:\Users\Gunner\Documents\Arduino\hardware\espressif\esp32/tools/sdk/include/bt" "-ID:\Users\Gunner\Documents\Arduino\hardware\espressif\esp32/tools/sdk/include/driver" "-ID:\Users\Gunner\Documents\Arduino\hardware\espressif\esp32/tools/sdk/include/esp32" "-ID:\Users\Gunner\Documents\Arduino\hardware\espressif\esp32/tools/sdk/include/esp_adc_cal" "-ID:\Users\Gunner\Documents\Arduino\hardware\espressif\esp32/tools/sdk/include/ethernet" "-ID:\Users\Gunner\Documents\Arduino\hardware\espressif\esp32/tools/sdk/include/fatfs" "-ID:\Users\Gunner\Documents\Arduino\hardware\espressif\esp32/tools/sdk/include/freertos" "-ID:\Users\Gunner\Documents\Arduino\hardware\espressif\esp32/tools/sdk/include/heap" "-ID:\Users\Gunner\Documents\Arduino\hardware\espressif\esp32/tools/sdk/include/jsmn" "-ID:\Users\Gunner\Documents\Arduino\hardware\espressif\esp32/tools/sdk/include/log" "-ID:\Users\Gunner\Documents\Arduino\hardware\espressif\esp32/tools/sdk/include/mdns" "-ID:\Users\Gunner\Documents\Arduino\hardware\espressif\esp32/tools/sdk/include/mbedtls" "-ID:\Users\Gunner\Documents\Arduino\hardware\espressif\esp32/tools/sdk/include/mbedtls_port" "-ID:\Users\Gunner\Documents\Arduino\hardware\espressif\esp32/tools/sdk/include/newlib" "-ID:\Users\Gunner\Documents\Arduino\hardware\espressif\esp32/tools/sdk/include/nvs_flash" "-ID:\Users\Gunner\Documents\Arduino\hardware\espressif\esp32/tools/sdk/include/openssl" "-ID:\Users\Gunner\Documents\Arduino\hardware\espressif\esp32/tools/sdk/include/spi_flash" "-ID:\Users\Gunner\Documents\Arduino\hardware\espressif\esp32/tools/sdk/include/sdmmc" "-ID:\Users\Gunner\Documents\Arduino\hardware\espressif\esp32/tools/sdk/include/spiffs" "-ID:\Users\Gunner\Documents\Arduino\hardware\espressif\esp32/tools/sdk/include/tcpip_adapter" "-ID:\Users\Gunner\Documents\Arduino\hardware\espressif\esp32/tools/sdk/include/ulp" "-ID:\Users\Gunner\Documents\Arduino\hardware\espressif\esp32/tools/sdk/include/vfs" "-ID:\Users\Gunner\Documents\Arduino\hardware\espressif\esp32/tools/sdk/include/wear_levelling" "-ID:\Users\Gunner\Documents\Arduino\hardware\espressif\esp32/tools/sdk/include/xtensa-debug-module" "-ID:\Users\Gunner\Documents\Arduino\hardware\espressif\esp32/tools/sdk/include/coap" "-ID:\Users\Gunner\Documents\Arduino\hardware\espressif\esp32/tools/sdk/include/console" "-ID:\Users\Gunner\Documents\Arduino\hardware\espressif\esp32/tools/sdk/include/expat" "-ID:\Users\Gunner\Documents\Arduino\hardware\espressif\esp32/tools/sdk/include/json" "-ID:\Users\Gunner\Documents\Arduino\hardware\espressif\esp32/tools/sdk/include/lwip" "-ID:\Users\Gunner\Documents\Arduino\hardware\espressif\esp32/tools/sdk/include/newlib" "-ID:\Users\Gunner\Documents\Arduino\hardware\espressif\esp32/tools/sdk/include/nghttp" "-ID:\Users\Gunner\Documents\Arduino\hardware\espressif\esp32/tools/sdk/include/soc" "-ID:\Users\Gunner\Documents\Arduino\hardware\espressif\esp32/tools/sdk/include/wpa_supplicant" -std=gnu++11 -fno-exceptions -Os -g3 -Wpointer-arith -fexceptions -fstack-protector -ffunction-sections -fdata-sections -fstrict-volatile-bitfields -mlongcalls -nostdlib -Wall -Werror=all -Wno-error=unused-function -Wno-error=unused-but-set-variable -Wno-error=unused-variable -Wno-error=deprecated-declarations -Wno-unused-parameter -Wno-sign-compare -fno-rtti -MMD -c -DF_CPU=240000000L -DARDUINO=10805 -DARDUINO_ESP32_DEV -DARDUINO_ARCH_ESP32 -DARDUINO_BOARD="ESP32_DEV" -DARDUINO_VARIANT="esp32" -DESP32 -DCORE_DEBUG_LEVEL=0 "-ID:\Users\Gunner\Documents\Arduino\hardware\espressif\esp32\cores\esp32" "-ID:\Users\Gunner\Documents\Arduino\hardware\espressif\esp32\variants\esp32" "-ID:\Users\Gunner\Documents\Arduino\libraries\Blynk\src" "C:\Users\Gunner\AppData\Local\Temp\arduino_build_159473\sketch\ESP32_BT_Classic.ino.cpp" -o "C:\Users\Gunner\AppData\Local\Temp\arduino_build_159473\sketch\ESP32_BT_Classic.ino.cpp.o"
In file included from D:\Users\Gunner\Documents\Arduino\- BLYNK\ESP32_BT_Classic\ESP32_BT_Classic.ino:26:0:
D:\Users\Gunner\Documents\Arduino\libraries\Blynk\src/BlynkSimpleEsp32_BT.h: In member function 'void BlynkTransportEsp32_BT::begin()':
D:\Users\Gunner\Documents\Arduino\libraries\Blynk\src/BlynkSimpleEsp32_BT.h:77:34: error: 'ESP_PWR_LVL_N0' was not declared in this scope
if (esp_bredr_tx_power_set(ESP_PWR_LVL_N0, ESP_PWR_LVL_P9) != ESP_OK)
^
D:\Users\Gunner\Documents\Arduino\libraries\Blynk\src/BlynkSimpleEsp32_BT.h:77:50: error: 'ESP_PWR_LVL_P9' was not declared in this scope
if (esp_bredr_tx_power_set(ESP_PWR_LVL_N0, ESP_PWR_LVL_P9) != ESP_OK)
^
D:\Users\Gunner\Documents\Arduino\libraries\Blynk\src/BlynkSimpleEsp32_BT.h:77:64: error: 'esp_bredr_tx_power_set' was not declared in this scope
if (esp_bredr_tx_power_set(ESP_PWR_LVL_N0, ESP_PWR_LVL_P9) != ESP_OK)
^
Using library Blynk at version 0.5.3 in folder: D:\Users\Gunner\Documents\Arduino\libraries\Blynk
exit status 1
Error compiling for board ESP32 Dev Module.
And later even installed your full blynk-library , but I am still unable to compile.
Compiling sketch...
"D:\Users\Gunner\Documents\Arduino\hardware\espressif\esp32/tools/xtensa-esp32-elf/bin/xtensa-esp32-elf-g++" -DESP_PLATFORM -DMBEDTLS_CONFIG_FILE="mbedtls/esp_config.h" -DHAVE_CONFIG_H "-ID:\Users\Gunner\Documents\Arduino\hardware\espressif\esp32/tools/sdk/include/config" "-ID:\Users\Gunner\Documents\Arduino\hardware\espressif\esp32/tools/sdk/include/bluedroid" "-ID:\Users\Gunner\Documents\Arduino\hardware\espressif\esp32/tools/sdk/include/app_trace" "-ID:\Users\Gunner\Documents\Arduino\hardware\espressif\esp32/tools/sdk/include/app_update" "-ID:\Users\Gunner\Documents\Arduino\hardware\espressif\esp32/tools/sdk/include/bootloader_support" "-ID:\Users\Gunner\Documents\Arduino\hardware\espressif\esp32/tools/sdk/include/bt" "-ID:\Users\Gunner\Documents\Arduino\hardware\espressif\esp32/tools/sdk/include/driver" "-ID:\Users\Gunner\Documents\Arduino\hardware\espressif\esp32/tools/sdk/include/esp32" "-ID:\Users\Gunner\Documents\Arduino\hardware\espressif\esp32/tools/sdk/include/esp_adc_cal" "-ID:\Users\Gunner\Documents\Arduino\hardware\espressif\esp32/tools/sdk/include/ethernet" "-ID:\Users\Gunner\Documents\Arduino\hardware\espressif\esp32/tools/sdk/include/fatfs" "-ID:\Users\Gunner\Documents\Arduino\hardware\espressif\esp32/tools/sdk/include/freertos" "-ID:\Users\Gunner\Documents\Arduino\hardware\espressif\esp32/tools/sdk/include/heap" "-ID:\Users\Gunner\Documents\Arduino\hardware\espressif\esp32/tools/sdk/include/jsmn" "-ID:\Users\Gunner\Documents\Arduino\hardware\espressif\esp32/tools/sdk/include/log" "-ID:\Users\Gunner\Documents\Arduino\hardware\espressif\esp32/tools/sdk/include/mdns" "-ID:\Users\Gunner\Documents\Arduino\hardware\espressif\esp32/tools/sdk/include/mbedtls" "-ID:\Users\Gunner\Documents\Arduino\hardware\espressif\esp32/tools/sdk/include/mbedtls_port" "-ID:\Users\Gunner\Documents\Arduino\hardware\espressif\esp32/tools/sdk/include/newlib" "-ID:\Users\Gunner\Documents\Arduino\hardware\espressif\esp32/tools/sdk/include/nvs_flash" "-ID:\Users\Gunner\Documents\Arduino\hardware\espressif\esp32/tools/sdk/include/openssl" "-ID:\Users\Gunner\Documents\Arduino\hardware\espressif\esp32/tools/sdk/include/spi_flash" "-ID:\Users\Gunner\Documents\Arduino\hardware\espressif\esp32/tools/sdk/include/sdmmc" "-ID:\Users\Gunner\Documents\Arduino\hardware\espressif\esp32/tools/sdk/include/spiffs" "-ID:\Users\Gunner\Documents\Arduino\hardware\espressif\esp32/tools/sdk/include/tcpip_adapter" "-ID:\Users\Gunner\Documents\Arduino\hardware\espressif\esp32/tools/sdk/include/ulp" "-ID:\Users\Gunner\Documents\Arduino\hardware\espressif\esp32/tools/sdk/include/vfs" "-ID:\Users\Gunner\Documents\Arduino\hardware\espressif\esp32/tools/sdk/include/wear_levelling" "-ID:\Users\Gunner\Documents\Arduino\hardware\espressif\esp32/tools/sdk/include/xtensa-debug-module" "-ID:\Users\Gunner\Documents\Arduino\hardware\espressif\esp32/tools/sdk/include/coap" "-ID:\Users\Gunner\Documents\Arduino\hardware\espressif\esp32/tools/sdk/include/console" "-ID:\Users\Gunner\Documents\Arduino\hardware\espressif\esp32/tools/sdk/include/expat" "-ID:\Users\Gunner\Documents\Arduino\hardware\espressif\esp32/tools/sdk/include/json" "-ID:\Users\Gunner\Documents\Arduino\hardware\espressif\esp32/tools/sdk/include/lwip" "-ID:\Users\Gunner\Documents\Arduino\hardware\espressif\esp32/tools/sdk/include/newlib" "-ID:\Users\Gunner\Documents\Arduino\hardware\espressif\esp32/tools/sdk/include/nghttp" "-ID:\Users\Gunner\Documents\Arduino\hardware\espressif\esp32/tools/sdk/include/soc" "-ID:\Users\Gunner\Documents\Arduino\hardware\espressif\esp32/tools/sdk/include/wpa_supplicant" -std=gnu++11 -fno-exceptions -Os -g3 -Wpointer-arith -fexceptions -fstack-protector -ffunction-sections -fdata-sections -fstrict-volatile-bitfields -mlongcalls -nostdlib -Wall -Werror=all -Wno-error=unused-function -Wno-error=unused-but-set-variable -Wno-error=unused-variable -Wno-error=deprecated-declarations -Wno-unused-parameter -Wno-sign-compare -fno-rtti -MMD -c -DF_CPU=240000000L -DARDUINO=10805 -DARDUINO_ESP32_DEV -DARDUINO_ARCH_ESP32 -DARDUINO_BOARD="ESP32_DEV" -DARDUINO_VARIANT="esp32" -DESP32 -DCORE_DEBUG_LEVEL=0 "-ID:\Users\Gunner\Documents\Arduino\hardware\espressif\esp32\cores\esp32" "-ID:\Users\Gunner\Documents\Arduino\hardware\espressif\esp32\variants\esp32" "-ID:\Users\Gunner\Documents\Arduino\libraries\blynk-library\src" "C:\Users\Gunner\AppData\Local\Temp\arduino_build_159473\sketch\ESP32_BT_Classic.ino.cpp" -o "C:\Users\Gunner\AppData\Local\Temp\arduino_build_159473\sketch\ESP32_BT_Classic.ino.cpp.o"
In file included from D:\Users\Gunner\Documents\Arduino\- BLYNK\ESP32_BT_Classic\ESP32_BT_Classic.ino:26:0:
D:\Users\Gunner\Documents\Arduino\libraries\blynk-library\src/BlynkSimpleEsp32_BT.h: In member function 'void BlynkTransportEsp32_BT::begin()':
D:\Users\Gunner\Documents\Arduino\libraries\blynk-library\src/BlynkSimpleEsp32_BT.h:77:34: error: 'ESP_PWR_LVL_N0' was not declared in this scope
if (esp_bredr_tx_power_set(ESP_PWR_LVL_N0, ESP_PWR_LVL_P9) != ESP_OK)
^
D:\Users\Gunner\Documents\Arduino\libraries\blynk-library\src/BlynkSimpleEsp32_BT.h:77:50: error: 'ESP_PWR_LVL_P9' was not declared in this scope
if (esp_bredr_tx_power_set(ESP_PWR_LVL_N0, ESP_PWR_LVL_P9) != ESP_OK)
^
D:\Users\Gunner\Documents\Arduino\libraries\blynk-library\src/BlynkSimpleEsp32_BT.h:77:64: error: 'esp_bredr_tx_power_set' was not declared in this scope
if (esp_bredr_tx_power_set(ESP_PWR_LVL_N0, ESP_PWR_LVL_P9) != ESP_OK)
^
Using library blynk-library at version 0.5.3 in folder: D:\Users\Gunner\Documents\Arduino\libraries\blynk-library
exit status 1
Error compiling for board ESP32 Dev Module.
My comment about updating ESP32 libraries is indeed about the compilation of following piece of code
if (esp_bredr_tx_power_set(ESP_PWR_LVL_N0, ESP_PWR_LVL_P9) != ESP_OK)
{
BLYNK_LOG1(BLYNK_F("esp_bredr_tx_power_set failed"));
};
This code is to increase the transmit power, and is non-crucial: you can simply delete this code without problems.
I think I am using the most recent defines, in the latest version they changed the transmittion power defines, and added following defines for backward compatibility, so you can probably replace them to let it compile.
ESP_PWR_LVL_P7 = ESP_PWR_LVL_P9
ESP_PWR_LVL_N2 = ESP_PWR_LVL_N0
According the following github, I think I am using the most recent defines, but it is maybe better to use the old ones in a release of a Blynk library (or delete this piece of the code).
// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef __ESP_BT_H__
#define __ESP_BT_H__
#include <stdint.h>
#include <stdbool.h>
#include "esp_err.h"
This file has been truncated. show original
I changed the values in BlynkSimpleEsp32.h to the old values for better compatibility with different versions.
if (esp_bredr_tx_power_set(ESP_PWR_LVL_N2, ESP_PWR_LVL_P7) != ESP_OK)
{
BLYNK_LOG1(BLYNK_F("esp_bredr_tx_power_set failed"));
};
1 Like