본문 바로가기
728x90
PlatformIO version 확인 PlatformIO 버전을 확인하려고 했는데, PlatformIO Home이라는 애의 버전과 PlatformIO Core라는 애의 버전 두 가지가 존재했다. PlatformIO Home과 PlatformIO Core의 차이점에 대해 찾아봤다! PlatformIO Home은 간단하게 User Interface다. PlatformIO의 여러 가지 기능을 편하게 사용할 수 있게 해주는 프로그램이다. PlatformIO Core와 PlatformIO IDE는 PlatformIO Home에 빌트인 되어 있는 기능들이다. 결론적으로 PlatformIO Home은 PlatformIO Core와 PlatformIO IDE을 포함하고 있다. https://docs.platformio.org/en/latest/home/i.. 2022. 3. 11.
아두이노 전역 변수 설정하기 아두이노 프로젝트를 진행하는데 전역 변수로 생성한 변수가 전역 변수가 아니다.. .hpp 파일에서 선언을 하고 .ino 파일에서 초기화를 했는데 .cpp 다른 파일에서 초기화가 안 되어있다.. 도대체 이게 무슨 일인가 내가 전역 변수 선언하는 법을 잘 못 알고 있나 싶어 하루 종일 구글링을 하고 코드에 여러 테스트를 하고 알아낸 결과 아두이노는 보통의 cpp와 전역 변수 설정하는 법이 달랐다..! cpp에서 전역 변수를 설정할 때 2가지 방법이 있다. 해당 파일 안에서만 전역 변수로 설정할 때는 static, 모든 파일 안에서 전역 변수로 쓰고 싶을 때는 extern으로 선언해주면 된다. 아두이노에서 전역 변수를 setup과 loop 밖에 선언된 변수를 전역 변수라 한다. 물론 이 변수는 지역변수를 선언.. 2022. 2. 18.
PlatformIO C++ 라이브러리 사용하기 PlatformIO를 IDE로 사용하니 c++ 라이브러리를 추가할 수 없었다.. 아무리 구글링해도 나오지 않음..! 열심히 찾다가 생각난 해결책이 내가 쓰려고 하는 c++ 라이브러리를 직접 다운받아 내 프로젝트 폴더에 넣어주고 platformio.ini에 라이브러리 경로를 추가해주면 되겠다였다! 💡 라이브러리 다운로드 나는 밑에 링크에 있는 라이브러리를 다운받았다. c++에서 쓰는 기본적인 라이브러리들이 들어있다. 밑의 라이브러리는 이라고 내가 원하는 헤더를 선택해 추가하는 것이 아니라 로 헤더를 추가하면 모든 밑의 깃에 있는 모든 라이브러리가 한 번에 추가된다. https://github.com/mike-matera/ArduinoSTL GitHub - mike-matera/ArduinoSTL: An S.. 2022. 2. 9.
PlatformIO 라이브러리 추가 라이브러리 종속성 변경 lib_deps = 경로 라이브러리 디렉토리 추가 lib_extra_dirs = 경로 https://docs.platformio.org/en/latest/librarymanager/quickstart.html Quick Start — PlatformIO latest documentation PlatformIO Library Manager allows one to specify project dependencies (lib_deps) that will be installed automatically per project before environment processing. You do not need to install libraries manually. The only one s.. 2022. 2. 9.
ESP8266에 MCP2515 CAN 통신 모듈 연결하기 핀 연결 정보 예제 소스 코드 https://github.com/Metaln00b/NodeMCU-BlackBox GitHub - Metaln00b/NodeMCU-BlackBox: ESP8266 based CAN-Bus Diagnostic Tool ESP8266 based CAN-Bus Diagnostic Tool. Contribute to Metaln00b/NodeMCU-BlackBox development by creating an account on GitHub. github.com 2022. 2. 6.
CAN 모듈 Board별 SPI_CS_PIN 핀번호 CAN 모듈이 아두이노와 통신할 때 SPI 통신을 사용한다. CAN 모듈을 아두이노에 연결해서 쓸 때 SPI_CS_PIN의 핀번호로 CAN를 초기화해줘야 한다. #define SPI_CS_PIN 9 MCP_CAN CAN(SPI_CS_PIN); SPI CS 관련 Reference https://en.wikipedia.org/wiki/Chip_select Chip select - Wikipedia An example SPI with a master and three slave select lines. Note that all four chips share the SCLK, MISO, and MOSI lines but each slave has its own slave select. Chip select (C.. 2022. 1. 27.
PlatformIO Serial Monitor 사용법 프로젝트 하단에 위 그림과 같은 버튼을 클릭하면 시리얼 모니터가 열린다. Serial Monitor의 속도를 조절하고 싶으면 platformio.ini에서 monitor_speed를 변경해주면 된다! monitor_speed = 115200​ 2022. 1. 26.
ESP8266 PlatformIO 프로젝트 설정하기 platformio.ini에 아래 코드로 바꿔주면 업로드 성공! [env:myenv] platform = espressif8266 board = nodemcuv2 framework = arduino Reference https://docs.platformio.org/en/latest/platforms/espressif8266.html Espressif 8266 — PlatformIO latest documentation © Copyright 2014-present, PlatformIO. docs.platformio.org 2022. 1. 26.
PlatformIO Library 추가하기 VSCode - PlatformIO로 아두이노 프로젝트를 진행하는 중 CAN 통신과 OBD2 헤더가 없어서 에러가 났다!!! 보통은 Arduino IDE처럼 library에 들어가 헤더를 검색해 다운을 받으면 되지만 CAN를 검색해도 안 나옴! (Platform IDE - HOME - 왼쪽 Libraries로 들어가면 헤더 검색 가능) PlatformIO Registry에 들어가서 라이브러리를 다운받았다 https://registry.platformio.org/ PlatformIO Registry The world's first package and project dependency management solution for embedded development registry.platformio.org.. 2022. 1. 19.
vscode에서 아두이노 빌드 오류 ⚠️ Error! 더보기 /Users/eeun/.platformio/packages/framework-arduino-avr/cores/arduino/USBCore.cpp:73:29: error: 'USB_VID' was not declared in this scope Build는 컴파일만 해보는 것(Upload가 아두이노에 설치까지)이기에 포트 설정을 딱히 해주지 않았는데.. 이런 오류를 접했다.. 해결법! "platformio.ini" 파일에 upload_port = COM5 코드를 추가해준다 아두이노 연결을 안해서 연결된 포트가 없지만, 일단은 임의로 COM5로 설정해줬다 [env:32u416m] ; atmelavr = avr microcontroller development platform plat.. 2022. 1. 10.
728x90