我正在尝试使用 puppeteer 从公司网站中提取一些表格。
但我不明白为什么浏览器打开 Chromium 而不是我的默认 Chrome,然后导致“TimeoutError:超过 30000 毫秒的导航超时”,不让我有足够的时间使用 CSS Selector。我找不到引用此的文档。
const puppeteer = require('puppeteer');
(async () => {
const browser = await puppeteer.launch({headless: false});
const page = await browser.newPage()
await page.goto('https://www....com');
//search tearm
await page.type("#search_term","Brazil");
//await page.screenshot({path: 'sc2.png'});
//await browser.close();
})();
Run Code Online (Sandbox Code Playgroud) 在Windows上,Atom的Platformio-Ide-Terminal的默认终端是Powershell(至少,这是我得到的,没有任何配置).
我更喜欢使用unix类型命令的终端.我已经安装了MINGW和CYGWIN.
如何避免打开Powershell并打开另一种终端类型?
当我echo %Path%在vscode的终端中运行时,结果是:
C:\Users\user\.platformio\penv\Scripts;C:\Users\user\.platformio\penv;C:\Users\user\.platformio\python3;C:\Program Files\Common Files\Oracle\Java\javapath;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Program Files (x86)\NAT Service;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files....
Run Code Online (Sandbox Code Playgroud)
但是当我在命令行(cmd.exe)中运行它时,结果是:
C:\Program Files\AdoptOpenJDK\jdk-8.0.292.10-hotspot\bin;C:\Program Files\AdoptOpenJDK\jdk-16.0.1.9-hotspot\bin;C:\Program Files (x86)\NAT Service;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\windows\system32;C:\windows;C:\windows\System32\Wbem;C:\windows\System32\WindowsPowerSh...
Run Code Online (Sandbox Code Playgroud)
这和我在 vscode 中得到的不一样。我尝试打开和关闭继承环境,重新启动 vscode,然后重新启动我的计算机,但没有任何变化。
如何使vscode中的%Path%与cmd.exe中的%Path%相同?
我当前的 vscode 设置是:
{
"terminal.integrated.shell.windows": "C:\\Windows\\System32\\cmd.exe",
"terminal.external.windowsExec": "C:\\Windows\\System32\\cmd.exe",
"window.zoomLevel": 0,
"editor.suggestSelection": "first",
"vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue",
"java.configuration.checkProjectSettingsExclusions": false,
"java.errors.incompleteClasspath.severity": "ignore",
"java.project.importOnFirstTimeStartup": "automatic",
"terminal.integrated.tabs.enabled": true,
"files.autoSave": "afterDelay",
"workbench.colorTheme": "Default Dark+",
"java.configuration.runtimes": [
{
"name": "JavaSE-16",
"path": "C:\\Program Files\\AdoptOpenJDK\\jdk-16.0.1.9-hotspot",
"default": true
},
{
"name": "JavaSE-1.8",
"path": "C:\\Program Files\\AdoptOpenJDK\\jdk-8.0.292.10-hotspot"
},
], …Run Code Online (Sandbox Code Playgroud) windows cmd environment-variables visual-studio-code platformio
我已经开始使用 Visual Studio Code + PlatformIO。一般来说,这对我来说很好,但有一件事让我很恼火:写作时的提示太宽泛。
例如,如果我输入Serial.,我会看到一个带有提示的框架。它应该是可见的方法可能列表以及对象使用Serial:.print,.println,.read等不幸的是,我在这里看到所有可能的方法,在我的系统中可用,从所有库等:

它使这种帮助毫无用处。怎么办?
我尝试将我的设置与没有出现此类问题的同事进行比较,并发现了一个不同之处。我不确定这是否是一个原因,但也许?即:在我的项目中,.vscode文件夹里面有一个c_cpp_properties.json部分,这里是扩展C/C++ Intellisense的配置,对吗?这里是: "intelliSenseMode": "clang-x64",根据帮助 clang-x64 适用于 MAC OS。但是我没有MAC!我用 W10 在 PC 上安装了这个软件,对于 Windows,这个值应该是 msvc-x64。但是如何改变呢?我尝试只编辑此字段,但在重新启动 VSC 后恢复先前的值。
我最近不得不擦拭我的计算机,在一切准备就绪并运行之后,是时候打开我之前正在处理的一些 ESP32 程序了,发现 VSCode 上的 Platform IO 将不再编译。运行编译器后,我收到以下错误:
Compiling .pio\build\esp32dev\FrameworkArduino\stdlib_noniso.c.o
Compiling .pio\build\esp32dev\FrameworkArduino\wiring_pulse.c.o
Compiling .pio\build\esp32dev\FrameworkArduino\wiring_shift.c.o
Archiving .pio\build\esp32dev\libFrameworkArduino.a
Linking .pio\build\esp32dev\firmware.elf
c:/users/lloyd/.platformio/packages/toolchain-xtensa32/bin/../lib/gcc/xtensa-esp32-elf/5.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: cannot find -lstdc++
collect2.exe: error: ld returned 1 exit status
*** [.pio\build\esp32dev\firmware.elf] Error 1
=========================================================================== [FAILED] Took 11.91 seconds ===========================================================================
The terminal process "C:\Users\lloyd\.platformio\penv\Scripts\platformio.exe 'run', '--target', 'upload'" terminated with exit code: 1.
Run Code Online (Sandbox Code Playgroud)
我开始调试并意识到即使使用最简单的程序也无法编译。我尝试了 Arduino IDE,效果很好,还有一些使用 CMaker 的示例,它们也可以正常工作。但是当我尝试上传以下代码时:
void setup()
{
// put your setup code here, to run once:
Serial.begin(115200);
}
void loop()
{
// put your main code here, to …Run Code Online (Sandbox Code Playgroud) crash是一个socks5代理应用程序。vscode 我使用platformIO。
所以我写的 settings.json 如下:
"http.proxyAuthorization": null,
"http.proxyStrictSSL": false,
"http.proxy": "socks5://127.0.0.1:7890"
Run Code Online (Sandbox Code Playgroud)
在 platformIO_CLi CMD 窗口中,我输入: pio pkg install -g --platform "platformio/espressif32@^5.1.1" 但它不起作用并且无法下载任何内容。
我怎样才能使WifiManager 库在 ESP32 板上工作?我正在使用 PlatformIO 来开发我的代码。
这是我的进口:
#include "esp_camera.h"
#include <Arduino.h>
#include <WiFiClientSecure.h>
#include <PubSubClient.h>
#include <ArduinoJson.h>
#include <EEPROM.h>
#include <WiFiManager.h>
WiFiClient espClient;
PubSubClient client(espClient);
WiFiManager wifiManager;
Run Code Online (Sandbox Code Playgroud)
platformio.ini
[env:esp32cam]
platform = espressif32
board = esp32cam
framework = arduino
monitor_speed = 115200
build_flags = -DMQTT_MAX_PACKET_SIZE=36000
lib_deps =
espressif/esp32-camera@^1.0.0
knolleary/PubSubClient@^2.8
bblanchon/ArduinoJson@^6.18.5
tzapu/WiFiManager@^0.16.0
Run Code Online (Sandbox Code Playgroud)
但是当我运行代码时,我收到以下错误:
.pio\libdeps\esp32cam\WiFiManager/WiFiManager.h:16:25: fatal error: ESP8266WiFi.h: No such file or directory
Run Code Online (Sandbox Code Playgroud)
经过进一步研究,我发现 WiFiManager 使用 ESP8266WiFi.h,现在我想知道如何使这个库在我的 ESP32 上工作,或者是否有替代库?该项目的自述文件确实说它可以在 ESP32 上运行。
我有VSCode和PlatformIO插件.当我启动串行监视器时,它总是以9600波特率开始.我想改变它,所以它始终以115200开头.
我可以通过按CTRL + T,b,115200更改已经运行的串行监视器的波特率,输入但我不想每次启动串行监视器时都这样做.
我找不到任何设置.我尝试speed = 115200在platformio.ini上添加一行但是没有改变任何东西.
我有几个用于家庭自动化的微控制器项目。我的每个节点都有一个在代码中手动设置的版本号。这个版本号是在节点启动的时候报告的,通知我运行的是哪个代码。
有时在对代码进行一些更改后会忘记更改版本号。所以必须找到一个自动解决方案。
我对解决方案有一些想法:
可以实施吗?或者有没有其他类似结果的解决方案?
在嵌入式项目上工作时,我注意到sprintf()以下代码的方法:
char ln2[16];
sprintf(ln2, "%f Volt", Data[Position].Voltage1);
Run Code Online (Sandbox Code Playgroud)
生成问号字符作为输出。
从上面的代码生成的输出是:
? Volt
Run Code Online (Sandbox Code Playgroud)
而输入声明为 double Voltage1 = 0.0;
尝试格式化整数时,似乎不存在相同的问题。
预期的工作如下:
char ln1[16];
sprintf(ln1, "POSITION %d", (Position + 1));
Run Code Online (Sandbox Code Playgroud)
并输出POSITION 3其中的Position是全局变量并声明为int。
实际保存数据的结构是:
struct data
{
int Position;
double Voltage1;
double Voltage2;
};
Run Code Online (Sandbox Code Playgroud)
以上全部针对VS Code 使用C / C ++ 和Platform.io扩展。
这是怎么了?
我正在使用PlatformIO用Arduino框架编译我的ESP8266(ESP12e)。在某些时候,如果按一定顺序使用#include,我会遇到错误。
下面是简化我的代码:
平台
[env:esp12e]
platform = espressif8266
board = esp12e
framework = arduino
upload_speed = 460800
Run Code Online (Sandbox Code Playgroud)
Teste.h
//#include <cstdlib> //<<--this
#include <cstring> //<<-- and/or this causes error!
#include <Arduino.h>
#include <map>
Run Code Online (Sandbox Code Playgroud)
测试文件
#include "Teste.h"
void setup() {}
void loop() {}
Run Code Online (Sandbox Code Playgroud)
输出量
$ pio run
Please wait while upgrading PlatformIO ...
Updating atmelavr @ 1.3.1: [Up-to-date]
Updating toolchain-atmelavr @ 1.40902.0: [Up-to-date]
Updating framework-arduinoavr @ 1.10612.1: [Up-to-date]
Updating espressif8266 @ 1.3.0: [Up-to-date]
Updating toolchain-xtensa @ 1.40802.0: [Up-to-date]
Updating tool-esptool @ …Run Code Online (Sandbox Code Playgroud) 由于错误,我需要在我的头文件和 Cpp 中实现一个头文件保护,因为在我不知道出了什么问题之前我从未使用过它,因为在某些类上它可以工作,而在一个类上它不会......最初问题更大,但我想我把它缩小到问题的根源。
LedHandler.h
#ifdef LED_HANDLER_H
#define LED_HANDLER_H
#include <Arduino.h>
#include <Adafruit_NeoPixel.h>
#include <FastLED.h>
/* #include "Led/LedFunction.h"
#include "Led/LedStates.h"
#include "Led/Fading.h" */
class LedHandler {
public:
LedHandler(int length, uint16_t pin);
void clear();
void show();
void setColor(int s, int r, int g, int b);
Adafruit_NeoPixel getStrip();
int getLength();
private:
/* LedStates ¤tState;
LedStates &targetState;
Fader<LedStates> &ledFader; */
int length;
Adafruit_NeoPixel strip;
CRGB* leds;
};
#endif
Run Code Online (Sandbox Code Playgroud)
LedHandler.cpp
#ifdef LED_HANDLER_H
#define LED_HANDLER_H
#include <Adafruit_NeoPixel.h>
#include <FastLED.h
#include "Handlers/LedHandler.h"
LedHandler::LedHandler(int length, uint16_t pin) { …Run Code Online (Sandbox Code Playgroud) 我无法在我的 arduino 项目上解决这个问题。我在 vscode 上使用 Platformio。
我想使用 MFRC522_I2C 库来读取 rfid 徽章,因此我创建了一个类来使用库方法。
该库可以在这里找到:https ://github.com/arozcan/MFRC522-I2C-Library
这是我的代码:
主要.cpp:
#include <Arduino.h>
#include "rfid/Rfid.hpp" // my rfid class
Rfid _rfid;
void setup()
{
Serial.begin(115200);
_rfid.setupRfid();
}
void loop()
{
_rfid.rfidLoop();
}
Run Code Online (Sandbox Code Playgroud)
射频识别.cpp:
#include "Rfid.hpp"
Rfid::Rfid(/* args */)
{
}
Rfid::~Rfid()
{
}
void Rfid::setupRfid()
{
_rfidReader.PCD_Init();
}
void Rfid::rfidLoop()
{
// here is my code to read the rfid
}
Run Code Online (Sandbox Code Playgroud)
射频识别.hpp:
#ifndef _RFID_HPP_
#define _RFID_HPP_
#include "../lib/rfidReader/MFRC522_I2C.h" // the MFRC522 library
MFRC522 _rfidReader(0x28);
class …Run Code Online (Sandbox Code Playgroud) c++ arduino multiple-definition-error visual-studio-code platformio
platformio ×13
c++ ×6
arduino ×5
esp32 ×2
esp8266 ×2
atom-editor ×1
baud-rate ×1
build ×1
c ×1
cmd ×1
compilation ×1
embedded ×1
intellisense ×1
node.js ×1
proxy ×1
puppeteer ×1
windows ×1