저는 Atom/PlatformIO를 처음 접했고 Arduino IDE 대신 Arduino를 사용하여 개발하려고했습니다.PlatformIO 치명적인 빌드 오류 : LiquidCrystal.h "해당 파일이나 디렉토리가 없습니다."
~ 사양 ~
base code used: Arduino ESP sample code "WifiBlueToothSwitch.ino"
Board: ESP-WROOM-32
Additional Components: 1602A (2x16) LCD
I 성공적으로 이전에 나는 LiquidCrystal을 포함하는 시도를했을 때 그러나, LCD 화면을 사용하기에 PlatformIO을 통해 ESP 모듈에서 다른 샘플 코드를 실행했습니다 지금까지이 문제에 대해 검색 한 사이트의 여러 가지의 그래서, "wire.h"헤더 파일의 누락 또한 가장 포인트를
src\main.cpp:22:27: fatal error: LiquidCrystal.h: No such file or directory
compilation terminated.
*** [.pioenvs\esp32dev\src\main.o] Error 1
[ERROR] Took 3.34 seconds
: .H 도서관, 그것은 나에게 빌드 오류를 제공합니다 , 그러나 그것을 프로그램에 포함시킨 후에도, 여전히 나에게이 오류를 준다.
#include <Arduino.h>
#include <WiFi.h>
#include <Wire.h>
#include <LiquidCrystal.h>
그래서 나는이 문제가 발생하는 이유를 완전히 확실하지 않다 다음과 같이 내 포함
입니다. 이 문제를 어떻게 해결할 수 있습니까?
편집 1 :
내가 조금 전에 콘솔을 통해 PlatformIO의 업데이트를 시도하는 제안이 다른 사이트를 통해 온, 그러나이 아무 소용했다. 모든 것이 "최신"으로 표시되었습니다.
Documents\PlatformIO\Projects\171031-143050-esp32dev> platformio update
Updating tool-scons @ 3.20501.2 [Up-to-date]
Updating tool-unity @ 1.20302.1 [Up-to-date]
Updating pysite-pioplus @ 0.4.2 [Up-to-date]
Updating contrib-piohome @ 0.3.1 [Up-to-date]
Updating tool-pioplus @ 0.10.11 [Up-to-date]
Platform Manager
================
Platform Espressif 32
--------
Updating espressif32 @ 0.10.0 [Up-to-date]
Updating tool-esptoolpy @ 1.20000.0 [Up-to-date]
Updating toolchain-xtensa32 @ 1.50200.0 [Up-to-date]
Updating framework-arduinoespressif32 @ 1.2.0 [Up-to-date]
Updating tool-espotapy @ 1.0.0 [Up-to-date]
Library Manager
===============
Documents\PlatformIO\Projects\171031-143050-esp32dev>
편집 2 :
나는 컴파일이 있고 아두 이노 IDE를 통해이 코드를 실행하고 문제가 PlatformIO IDE와 것 같다, 그래서 작동하는지 확인할 수 있습니다 ...
편집 3 :
다음 후 그러나 이것은 또한 빌드하는 동안 다음과 같은 의존성 오류가 발생,
lib_extra_dirs = C:\Program Files (x86)\Arduino\hardware\espressif\esp32\libraries
이것은 LiquidCrystal.h의 초기 오류를 수정 : BMelis의 제안, 나는 PlatformIO.ini 파일에보고하고, 다음 줄을 추가
[11/06/17 08:52:58] Processing esp32dev (platform: espressif32; lib_extra_dirs: C:\Program Files (x86)\Arduino\hardware\espressif\esp32\libraries; board: esp32dev; framework: arduino)
Verbose mode can be enabled via `-v, --verbose` option
Collected 49 compatible libraries
Looking for dependencies...
Library Dependency Graph
|-- <WiFi> v1.0
|-- <Wire> v1.0
|-- <LiquidCrystal> v1.0.7
Compiling .pioenvs\esp32dev\lib\WiFi\WiFiAP.o
Compiling .pioenvs\esp32dev\lib\WiFi\WiFiGeneric.o
Compiling .pioenvs\esp32dev\lib\WiFi\WiFiMulti.o
Compiling .pioenvs\esp32dev\lib\WiFi\WiFiSTA.o
****ERROR OCCURRED****
C:\Program Files (x86)\Arduino\hardware\espressif\esp32\libraries\WiFi\src\WiFiAP.cpp:40:37: fatal error: apps/dhcpserver_options.h: No such file or directory
compilation terminated.
*** [.pioenvs\esp32dev\lib\WiFi\WiFiAP.o] Error 1
[ERROR] Took 8.13 seconds
I 그것이 제 lib_extra_dirs 추가하여 언급 된 디렉토리를 추가하는 시도는 ini 파일에 명령 그러나
lib_extra_dirs = C:\Program Files (x86)\Arduino\hardware\espressif\esp32\tools\sdk\include\lwip\apps
이 D 이드는이 문제를 해결할 아무 것도 아니다. 나는 ... 지금 무엇을해야하는지에 관해서는 딱하다
FULL CODE :
#include <Arduino.h>
// 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.
// Sketch shows how to switch between WiFi and BlueTooth or use both
// Button is attached between GPIO 0 and GND and modes are switched with each press
#include <WiFi.h>
#include <Wire.h>
#include <LiquidCrystal.h>
#define STA_SSID "HIDDEN FOR SECURITY"
#define STA_PASS "HIDDEN FOR SECURITY"
#define AP_SSID "esp32 @ my desk"
#define LED_PIN 5
//LCD variables on analog inputs, but used as digital I/O
//lcd_gnd = gnd
//lcd_vcc = +5v
//lcd_v0 = +5v & pot
const int lcd_rs = 27;
//lcd_rw = gnd
const int lcd_e = 14;
//lcd_d0 = n/a
//lcd_d1 = n/a
//lcd_d2 = n/a
//lcd_d3 = n/a
const int lcd_d4 = 32;
const int lcd_d5 = 33;
const int lcd_d6 = 25;
const int lcd_d7 = 26;
//lcd_bl1 = +5v
//lcd_bl2 = gnd
LiquidCrystal lcd(lcd_rs, lcd_e, lcd_d4, lcd_d5, lcd_d6, lcd_d7);
enum { STEP_BTON, STEP_BTOFF, STEP_STA, STEP_AP, STEP_AP_STA, STEP_OFF, STEP_BT_STA, STEP_END };
void onButton(){
static uint32_t step = STEP_BTON;
switch(step){
case STEP_BTON://BT Only
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Starting BT");
btStart();
break;
case STEP_BTOFF://All Off
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Stopping BT");
btStop();
break;
case STEP_STA://STA Only
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Starting STA");
WiFi.begin(STA_SSID, STA_PASS);
break;
case STEP_AP://AP Only
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Stopping STA");
WiFi.mode(WIFI_AP);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Starting AP");
WiFi.softAP(AP_SSID);
break;
case STEP_AP_STA://AP+STA
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Starting STA");
WiFi.begin(STA_SSID, STA_PASS);
break;
case STEP_OFF://All Off
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Stopping WiFi");
WiFi.mode(WIFI_OFF);
break;
case STEP_BT_STA://BT+STA
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Starting STA+BT");
WiFi.begin(STA_SSID, STA_PASS);
btStart();
break;
case STEP_END://All Off
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Stopping WiFi+BT");
WiFi.mode(WIFI_OFF);
btStop();
break;
default:
break;
}
if(step == STEP_END){
step = STEP_BTON;
} else {
step++;
}
//little debounce
delay(100);
}
void WiFiEvent(WiFiEvent_t event){
switch(event) {
case SYSTEM_EVENT_AP_START:
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("AP Started");
Serial.print("AP Started");
WiFi.softAPsetHostname(AP_SSID);
break;
case SYSTEM_EVENT_AP_STOP:
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("AP Stopped");
Serial.print("AP Stopped");
break;
case SYSTEM_EVENT_STA_START:
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("STA Started");
Serial.print("STA Started");
WiFi.setHostname(AP_SSID);
break;
case SYSTEM_EVENT_STA_CONNECTED:
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("STA Connected");
Serial.print("STA Connected");
WiFi.enableIpV6();
break;
case SYSTEM_EVENT_AP_STA_GOT_IP6:
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("STA IPv6: ");
Serial.print("STA IPv6: ");
Serial.println(WiFi.localIPv6());
break;
case SYSTEM_EVENT_STA_GOT_IP:
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("STA IPv4: ");
Serial.print("STA IPv4: ");
lcd.setCursor(0,1);
lcd.print(WiFi.localIP());
Serial.print(WiFi.localIP());
break;
case SYSTEM_EVENT_STA_DISCONNECTED:
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("STA Disconnected");
Serial.print("STA Disconnected");
break;
case SYSTEM_EVENT_STA_STOP:
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("STA Stopped");
Serial.print("STA Stopped");
break;
default:
break;
}
}
void setup() {
lcd.begin(16, 2); //tells arduino that the LCD is a 16x2 size LCD
lcd.clear(); //clear any previous text
lcd.setCursor(0, 0); // set cursor to column 0 of row 0 (first row, first block)
pinMode(LED_PIN, OUTPUT);
digitalWrite(LED_PIN, LOW); // LED off
Serial.begin(115200);
pinMode(0, INPUT_PULLUP);
WiFi.onEvent(WiFiEvent);
Serial.print("ESP32 SDK: ");
Serial.println(ESP.getSdkVersion());
Serial.println("Press the button to select the next mode");
lcd.setCursor(0, 0);
lcd.println("Press mode btn");
}
void loop() {
digitalWrite(LED_PIN, HIGH); // Turn on LED
static uint8_t lastPinState = 1;
uint8_t pinState = digitalRead(0);
if(!pinState && lastPinState){
onButton();
}
lastPinState = pinState;
}
Pio는 일반 장소에서 파일을 찾을 수 없습니다. 그래서 Pio에게 다른 곳을 바라 보라고 지시해야합니다. platformio.ini에서 정의 할 수 있습니다. [link] (http://docs.platformio.org/en/latest/projectconf.html) (이 작업은 한 가지 방법 일 뿐이며 다른 작업도 있습니다!) lib가 컴퓨터에 저장되어 있고 platformio.ini 파일은 어떻게 생겼습니까? – BMelis
@BMelis 정보를 제공해 주셔서 감사합니다! 나는 여전히 Platform과 Atom에 대해 매우 새롭기 때문에 LiquidCrystal.h와 같은 표준 라이브러리가 기본적으로 포함되었을 것이라고 생각했습니다. 나는 경로를 업데이트하고 이것이 작동하는지 알려줄 것입니다. – Jason
@BMelis 지체 한 것에 대해 유감스럽게 생각합니다. 다소 추운 날씨를 맞이하고 지난 며칠간 회복하고있었습니다. 불행히도, .ini 파일에 라이브러리 경로를 추가 했음에도 불구하고 여전히이 오류와 관련된 문제가 발생합니다. 이제 문제는 다음과 같습니다. C : \ Program Files (x86) \ Arduino \ hardware \ espressif \ esp32 \ libraries \ WiFi \ src \ WiFiAP.cpp : 40 : 37 : 치명적인 오류 : apps /dhcpserver_options.h : 해당 파일이나 디렉토리가 없습니다. 컴파일이 종료되었습니다. *** [.pioenvs \ esp32dev \ lib \ WiFi \ WiFiAP.o] 오류 1' – Jason