Esp32 转弯导航

问题描述 投票:0回答:1

我正在尝试创建一个应用程序,允许我使用我的 esp32 作为“GPS”进行逐向导航。

我搜索了很多,看到了很多项目,但无法理解其中任何一个+它发现其中一些项目不再起作用。基本上我使用 BLEDevices 来与我的 esp32 和我的 Android 手机创建蓝牙连接

#include <BLEDevice.h>
#include <BLEUtils.h>
#include <BLEServer.h>

// See the following for generating UUIDs:
// https://www.uuidgenerator.net/

#define SERVICE_UUID        "4fafc201-1fb5-459e-8fcc-c5c9c331914b"
#define CHARACTERISTIC_UUID "beb5483e-36e1-4688-b7f5-ea07361b26a8"

void setup() {
  Serial.begin(115200);
  Serial.println("Starting BLE work!");

  BLEDevice::init("Long name works now");
  BLEServer *pServer = BLEDevice::createServer();
  BLEService *pService = pServer->createService(SERVICE_UUID);
  BLECharacteristic *pCharacteristic = pService->createCharacteristic(
                                         CHARACTERISTIC_UUID,
                                         BLECharacteristic::PROPERTY_READ |
                                         BLECharacteristic::PROPERTY_WRITE
                                       );

  pCharacteristic->setValue("Hello World says Neil");
  pService->start();
  // BLEAdvertising *pAdvertising = pServer->getAdvertising();  // this still is working for backward compatibility
  BLEAdvertising *pAdvertising = BLEDevice::getAdvertising();
  pAdvertising->addServiceUUID(SERVICE_UUID);
  pAdvertising->setScanResponse(true);
  pAdvertising->setMinPreferred(0x06);  // functions that help with iPhone connections issue
  pAdvertising->setMinPreferred(0x12);
  BLEDevice::startAdvertising();
  Serial.println("Characteristic defined! Now you can read it in your phone!");
}

void loop() {
  // put your main code here, to run repeatedly:
  delay(2000);
}

主要问题是我不知道我可以在手机中使用哪个应用程序(waze、komoot、sygic ...)来获取前下一步动作、速度等并将其发送到我的 esp32。另外我已经尝试过不同的方法,例如 KomootBLEConnect.h,我的手机连接到 esp32 蓝牙,但它不显示任何有关导航的信息

#include "Arduino.h"
#include "KomootBLEConnect.h"

//When data is received from Komoot, this callback is triggered. Start your processing here
void NavCallback(uint8_t icon, uint32_t length, String street)
{
  Serial.printf("icon: %d, length %d, street: %s\n", icon,length,street);
}

void setup()
{
  Serial.begin(9600);
  Serial.println("Starting Arduino BLE Client application...");
  Komoot::BLEHandler::Begin("ESP32 Komoot");
  Komoot::BLEHandler::RegisterCallback(NavCallback);
}


void loop()
{
  Komoot::BLEHandler::Loop(); //Scans for BLE devices that serve the BLEConnect Service and connects to them IF paired
  delay(1000);
}

c++ navigation esp32 arduino-esp8266
1个回答
0
投票

我做了一个与 Sygic 应用程序一起运行的东西,但我们这里有一个重要的问题:Sygic 的开发团队会随时删除此功能。 供您参考: https://vt.tiktok.com/ZSNLPUuWQ/

© www.soinside.com 2019 - 2024. All rights reserved.