我正在创建一个涉及蓝牙和 WiFi 的应用程序。我首先将手机连接到蓝牙,并通过它传递 WiFi ssid 和密码。然后,在收到 ssid 和密码后,我尝试将其连接到 WiFi。我设法将 ssid 和密码存储到一个字符数组中。
从蓝牙发送数据后,ESP32 与 WiFi 建立连接后,蓝牙断开。我无法再次连接蓝牙,因为 WiFi 已连接,因为我通过 Bluetooth.read() 控制代码中的某些语句,所以我需要允许连接在 WiFi 和蓝牙之间共存。
该项目由 SPIFFS(闪存保存)组成。首先从蓝牙传递WiFi ssid和密码,然后,我将接收到的蓝牙数据连接到一个字符数组中,以便稍后将其连接到互联网。
\n
我首先想到添加一个回调,在设备尝试连接时发出警报,但在文档中找不到任何能够执行此操作的代码。我有一个回调函数,可以告诉我设备何时连接和断开连接。\n
\n我搜索并找到了相关内容,Menuconfig
但找不到它所在的位置。\n
\n这是我正在阅读的内容:https: //www.espressif.com/sites/default/files/documentation/ESP32_FAQs__EN.pdf
5.3.2.\nHow do ESP32 Bluetooth and Wi-Fi coexist?\nIn the menuconfig menu, there is a special option called \xe2\x80\x9cSoftware controls WiFi/ \nBluetooth coexistence\xe2\x80\x9d, which is used to control the ESP32\'s Bluetooth and Wi-Fi \ncoexistence using software, thus balancing the coexistence requirement for controlling \nthe RF module by both …
Run Code Online (Sandbox Code Playgroud) 我刚刚从 GitHub 上的库中提取了一些内容,我正在使用 Windows 计算机在 VSCode 中进行编码。代码没有问题,尽管当我尝试运行 npm install 或yarn install 来获取node_modules 和yarn.lock 时,我收到一个奇怪的错误并且包不起作用。我使用 ZSH 作为 Mac 的终端。
这是错误输出:
niltonsf@Niltons-MacBook-Pro ignews.nosync % sudo yarn install
Password:
yarn install v1.22.15
[1/4] Resolving packages...
[2/4] Fetching packages...
error An unexpected error occurred: "https://registry.yarnpkg.com/acorn/-/acorn-7.4.1.tgz: incorrect data check".
info If you think this is a bug, please open a bug report with the information provided in "/Users/niltonsf/Desktop/ignews.nosync/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
error https://registry.yarnpkg.com/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-11.1.2.tgz: incorrect data check
error https://registry.yarnpkg.com/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-11.1.2.tgz: incorrect data …
Run Code Online (Sandbox Code Playgroud) 我刚刚更新到 XCODE 15 和 Macos SONOMA。我收到了有关周期的问题:
\nCycle inside MyApp; building could produce unreliable results.\nCycle details:\n\xe2\x86\x92 Target \'MyApp\': ExtractAppIntentsMetadata\n\xe2\x97\x8b Target \'MyApp\': CodeSign /Users/me/Library/Developer/Xcode/DerivedData/ProjectA-frqscjhianktlvbxgbzostesljpn/Build/Products/Debug-iphoneos/MyApp.app/Frameworks/3rdPartyFramework.framework\n\xe2\x97\x8b Target \'MyApp\' has copy command from \'/Users/me/Desktop/Checkouts/MyApp/theApp/MyApp/ios/3rdPartyFramework.framework\' to \'/Users/me/Library/Developer/Xcode/DerivedData/ProjectA-frqscjhianktlvbxgbzostesljpn/Build/Products/Debug-iphoneos/MyApp.app/Frameworks/3rdPartyFramework.framework\'\n\xe2\x97\x8b Target \'MyApp\' has copy command from \'/Users/me/Library/Developer/Xcode/DerivedData/ProjectA-frqscjhianktlvbxgbzostesljpn/Build/Products/Debug-iphoneos/CallExtension.appex\' to \'/Users/me/Library/Developer/Xcode/DerivedData/ProjectA-frqscjhianktlvbxgbzostesljpn/Build/Products/Debug-iphoneos/MyApp.app/PlugIns/CallExtension.appex\'\n\xe2\x97\x8b That command depends on command in Target \'MyApp\': script phase \xe2\x80\x9cAdd Git/CI Build Info\xe2\x80\x9d\n\xe2\x97\x8b Target \'MyApp\' has process command with output \'/Users/me/Library/Developer/Xcode/DerivedData/ProjectA-frqscjhianktlvbxgbzostesljpn/Build/Products/Debug-iphoneos/MyApp.app/Info.plist\'\n\xe2\x97\x8b Target \'MyApp\' has copy command from \'/Users/me/Desktop/Checkouts/MyApp/theApp/MyApp/ios/3rdPartyFramework.framework\' to \'/Users/me/Library/Developer/Xcode/DerivedData/ProjectA-frqscjhianktlvbxgbzostesljpn/Build/Products/Debug-iphoneos/MyApp.app/Frameworks/3rdPartyFramework.framework\'\n\n\nRaw dependency cycle trace:\n\ntarget: ->\n\nnode: <all> ->\n\ncommand: <all> ->\n\nnode: …
Run Code Online (Sandbox Code Playgroud) 我试图在我的 firebase 上匿名登录,我已经添加了 FireBase 页面中显示的所有需要的东西,但是由于某种原因,当我尝试匿名登录时,我得到了这个错误:
I/flutter ( 1656): MissingPluginException(No implementation found for method signInAnonymously on
channel plugins.flutter.io/firebase_auth)
I/flutter ( 1656): Log in error
Run Code Online (Sandbox Code Playgroud)
这是我的匿名登录代码,在我的页面上没有显示任何错误:
import 'package:firebase_auth/firebase_auth.dart';
//Definir os metodos que vao interagir com firebase
class AuthService {
final FirebaseAuth _auth = FirebaseAuth.instance;
//Logar anonimamente
Future signInAnon() async {
try {
AuthResult result = await _auth.signInAnonymously();
FirebaseUser user = result.user;
return user;
}catch (e) {
print(e.toString());
return null;
}
}
Run Code Online (Sandbox Code Playgroud)
在主页面调用它:
import 'package:flutter/material.dart';
import 'package:homeautomation/services/auth.dart';
class _SignInState extends State<SignIn> {
final …
Run Code Online (Sandbox Code Playgroud) 我一直在从事一个涉及ESP32蓝牙和Flutter应用程序的项目。大约一周前,我的应用程序工作正常,没有这些警告消息,我在外面呆了一段时间,无法使用它,当我回来时,遇到了这条消息。该应用程序似乎工作正常,但每当我点击或单击某些内容时,我都会收到此“警告”消息。
如果我在 IOS 模拟器中运行该应用程序,它会正常工作而不会出现此错误,但在我的 Android 设备上运行时,会出现该错误。
这是我不断收到的消息:
Launching lib/main.dart on LM G710 in debug mode...\nlib/main.dart:1\n\xe2\x9c\x93 Built build/app/outputs/flutter-apk/app-debug.apk.\nConnecting to VM Service at ws://127.0.0.1:00000/dasdj02D-m=/sas\nW/PlatformPlugin(23531): Attempted to get clipboard data that requires additional permission(s).\nW/PlatformPlugin(23531): See the exception details for which permission(s) are required, and consider adding them to your Android Manifest as described in:\nW/PlatformPlugin(23531): https://developer.android.com/guide/topics/permissions/overview\nW/PlatformPlugin(23531): java.lang.SecurityException: Permission Denial: reading com.android.providers.media.MediaProvider uri content://media/external/file/147669 from pid=23531, uid=10406 requires android.permission.READ_EXTERNAL_STORAGE, or grantUriPermission()\nW/PlatformPlugin(23531): at android.os.Parcel.createException(Parcel.java:1950)\nW/PlatformPlugin(23531): at android.os.Parcel.readException(Parcel.java:1918)\nW/PlatformPlugin(23531): at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:183)\nW/PlatformPlugin(23531): at android.database.DatabaseUtils.readExceptionWithFileNotFoundExceptionFromParcel(DatabaseUtils.java:146)\nW/PlatformPlugin(23531): at android.content.ContentProviderProxy.openTypedAssetFile(ContentProviderNative.java:698)\nW/PlatformPlugin(23531): at android.content.ContentResolver.openTypedAssetFileDescriptor(ContentResolver.java:1460)\nW/PlatformPlugin(23531): at …
Run Code Online (Sandbox Code Playgroud) 我正在开发一个使用 Flash 数据保存的项目。我正在使用 ESP32 的 SPIFFS 库,目前正在尝试将每行的数据存储到字符串中。由于我可以控制文件中可以包含多少内容,因此不需要超过 3 个字符串来存储数据。我可以轻松地使用 来存储第一行内容readStringUntil
。但我无法从第 2 行和第 3 行获取内容。
\n对于第一行,我使用以下代码:
//Pegar a primeira linha do arquivo, onde ser\xc3\xa1 armazenado o nome do WIFI (ssid)\nvoid first_line (){\n file = SPIFFS.open("/wifi.txt", "r");\n\n while (file.available()) {\n String first_line = file.readStringUntil('\\n');\n Serial.print(first_line);\n break;\n }\n\n file.close();\n}\n
Run Code Online (Sandbox Code Playgroud)\n我使用此函数将代码写入文件:
\n// Escrever mensagem dentro do arquivo\nvoid write_file_info(String message) {\n file = SPIFFS.open("/wifi.txt", FILE_WRITE);\n\n if (!file){\n Serial.println("Error opening file");\n return;\n }else{\n Serial.println("Success opening file");\n }\n\n if (file.println(message)){\n Serial.println("File was …
Run Code Online (Sandbox Code Playgroud) 我正在开发一个带有 bare expo 和 React Native 的项目。我已经在我的项目中实施了 firebase。登录和注册工作正常。我创建了一个身份验证检查,以便在用户登录时将其发送到另一个页面。尽管在尝试将用户发送到另一个页面时收到以下错误:
这是我的 App.tsx:
import React, { useEffect, useState } from 'react';
import { StatusBar } from 'expo-status-bar';
import { ThemeProvider } from 'styled-components';
import {
useFonts,
Poppins_400Regular,
Poppins_500Medium,
Poppins_700Bold
} from '@expo-google-fonts/poppins';
import AppLoading from 'expo-app-loading';
import theme from './src/global/styles/theme';
import { NavigationContainer } from '@react-navigation/native';
import { AppRoutes } from './src/routes/app.routes';
import 'intl';
import 'intl/locale-data/jsonp/pt-BR';
import { SignIn } from './src/screens/SignIn';
import auth, { FirebaseAuthTypes } from '@react-native-firebase/auth';
export default function App() …
Run Code Online (Sandbox Code Playgroud)