8000 arduino-esp32/idf_component_examples/Hello_world at master · autosportlabs/arduino-esp32 · GitHub
[go: up one dir, main page]

Skip to content
{"payload":{"allShortcutsEnabled":false,"path":"idf_component_examples/Hello_world","repo":{"id":805901943,"defaultBranch":"master","name":"arduino-esp32","ownerLogin":"autosportlabs","currentUserCanPush":false,"isFork":true,"isEmpty":false,"createdAt":"2024-05-25T19:46:39.000Z","ownerAvatar":"https://avatars.githubusercontent.com/u/1274125?v=4","public":true,"private":false,"isOrgOwned":true},"currentUser":null,"refInfo":{"name":"master","listCacheKey":"v0:1716671506.0","canEdit":false,"refType":"branch","currentOid":"d164df89de350aa945ccb0cb4261f56306bfdb3c"},"tree":{"items":[{"name":"main","path":"idf_component_examples/Hello_world/main","contentType":"directory"},{"name":"CMakeLists.txt","path":"idf_component_examples/Hello_world/CMakeLists.txt","contentType":"file"},{"name":"README.md","path":"idf_component_examples/Hello_world/README.md","contentType":"file"},{"name":"sdkconfig.defaults","path":"idf_component_examples/Hello_world/sdkconfig.defaults","contentType":"file"}],"templateDirectorySuggestionUrl":null,"readme":{"displayName":"README.md","richText":"\u003carticle class=\"markdown-body entry-content container-lg\" itemprop=\"text\"\u003e\u003cmarkdown-accessiblity-table\u003e\u003ctable\u003e\n\u003cthead\u003e\n\u003ctr\u003e\n\u003cth\u003eSupported Targets\u003c/th\u003e\n\u003cth\u003eESP32\u003c/th\u003e\n\u003cth\u003eESP32-C2\u003c/th\u003e\n\u003cth\u003eESP32-C3\u003c/th\u003e\n\u003cth\u003eESP32-C6\u003c/th\u003e\n\u003cth\u003eESP32-H2\u003c/th\u003e\n\u003cth\u003eESP32-S2\u003c/th\u003e\n\u003cth\u003eESP32-S3\u003c/th\u003e\n\u003c/tr\u003e\n\u003c/thead\u003e\n\u003c/table\u003e\u003c/markdown-accessiblity-table\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch1 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003e\u003cem\u003eHello world example\u003c/em\u003e\u003c/h1\u003e\u003ca id=\"user-content-hello-world-example\" class=\"anchor\" aria-label=\"Permalink: Hello world example\" href=\"#hello-world-example\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eThis is the simplest buildable example made to be used as a template for new projects running Arduino-esp32 as an ESP-IDF component.\nSee \u003ca href=\"https://components.espressif.com/components/espressif/arduino-esp32\" rel=\"nofollow\"\u003eArduino-esp32\u003c/a\u003e in ESP Registry.\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eHow to use example\u003c/h2\u003e\u003ca id=\"user-content-how-to-use-example\" class=\"anchor\" aria-label=\"Permalink: How to use example\" href=\"#how-to-use-example\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eTo create a ESP-IDF project from this example with the latest release of Arduino-esp32, you can simply run command: \u003ccode\u003eidf.py create-project-from-example \"espressif/arduino-esp32:hello_world\"\u003c/code\u003e.\nESP-IDF will download all dependencies needed from the component registry and setup the project for you.\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eIf you want to use cloned Arduino-esp32 repository, you can build this example directly.\nGo to the example folder \u003ccode\u003earduino-esp32/idf_component_examples/Hello_world\u003c/code\u003e.\nFirst you need to comment line 6 \u003ccode\u003epre_release: true\u003c/code\u003e in examples \u003ccode\u003e/main/idf_component.yml\u003c/code\u003e.\nThen just run command: \u003ccode\u003eidf.py build\u003c/code\u003e.\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eExample folder contents\u003c/h2\u003e\u003ca id=\"user-content-example-folder-contents\" class=\"anchor\" aria-label=\"Permalink: Example folder contents\" href=\"#example-folder-contents\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eThe project \u003cstrong\u003eHello_world\u003c/strong\u003e contains one source file in C++ language \u003ca href=\"/autosportlabs/arduino-esp32/blob/master/idf_component_examples/Hello_world/main/main.cpp\"\u003emain.cpp\u003c/a\u003e. The file is located in folder \u003ca href=\"/autosportlabs/arduino-esp32/blob/master/idf_component_examples/Hello_world/main\"\u003emain\u003c/a\u003e.\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eESP-IDF projects are built using CMake. The project build configuration is contained in \u003ccode\u003eCMakeLists.txt\u003c/code\u003e\nfiles that provide set of directives and instructions describing the project's source files and targets\n(executable, library, or both).\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eBelow is short explanation of remaining files in the project folder.\u003c/p\u003e\n\u003cdiv class=\"snippet-clipboard-content notranslate position-relative overflow-auto\" data-snippet-clipboard-copy-content=\"├── CMakeLists.txt\n├── main\n│   ├── CMakeLists.txt\n│ ├── idf_component.yml\n│   └── main.cpp\n└── README.md This is the file you are currently reading\"\u003e\u003cpre class=\"notranslate\"\u003e\u003ccode\u003e├── CMakeLists.txt\n├── main\n│   ├── CMakeLists.txt\n│ ├── idf_component.yml\n│   └── main.cpp\n└── README.md This is the file you are currently reading\n\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eHow to add Arduino libraries\u003c/h2\u003e\u003ca id=\"user-content-how-to-add-arduino-libraries\" class=\"anchor\" aria-label=\"Permalink: How to add Arduino libraries\" href=\"#how-to-add-arduino-libraries\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eIn the project create folder \u003ccode\u003ecomponents/\u003c/code\u003e and clone the library there.\nIn the library folder create new CMakeLists.txt file, add lines shown below to the file and edit the SRCS to match the library source files.\u003c/p\u003e\n\u003cdiv class=\"snippet-clipboard-content notranslate position-relative overflow-auto\" data-snippet-clipboard-copy-content=\"idf_component_register(SRCS \u0026quot;user_library.cpp\u0026quot; \u0026quot;another_source.c\u0026quot;\n INCLUDE_DIRS \u0026quot;.\u0026quot;\n REQUIRES arduino-esp32\n )\"\u003e\u003cpre class=\"notranslate\"\u003e\u003ccode\u003eidf_component_register(SRCS \"user_library.cpp\" \"another_source.c\"\n INCLUDE_DIRS \".\"\n REQUIRES arduino-esp32\n )\n\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eBelow is structure of the project folder with the Arduino libraries.\u003c/p\u003e\n\u003cdiv class=\"snippet-clipboard-content notranslate position-relative overflow-auto\" data-snippet-clipboard-copy-content=\"├── CMakeLists.txt\n├── components\n│   ├── user_library\n│   │   ├── CMakeLists.txt This needs to be added\n│   │   ├── ...\n├── main\n│   ├── CMakeLists.txt\n│ ├── idf_component.yml\n│   └── main.cpp\n└── README.md This is the file you are currently reading\"\u003e\u003cpre class=\"notranslate\"\u003e\u003ccode\u003e├── CMakeLists.txt\n├── components\n│   ├── user_library\n│   │   ├── CMakeLists.txt This needs to be added\n│   │   ├── ...\n├── main\n│   ├── CMakeLists.txt\n│ ├── idf_component.yml\n│   └── main.cpp\n└── README.md This is the file you are currently reading\n\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\n\u003c/article\u003e","errorMessage":null,"headerInfo":{"toc":[{"level":1,"text":"Hello world example","anchor":"hello-world-example","htmlText":"Hello world example"},{"level":2,"text":"How to use example","anchor":"how-to-use-example","htmlText":"How to use example"},{"level":2,"text":"Example folder contents","anchor":"example-folder-contents","htmlText":"Example folder contents"},{"level":2,"text":"How to add Arduino libraries","anchor":"how-to-add-arduino-libraries","htmlText":"How to add Arduino libraries"}],"siteNavLoginPath":"/login?return_to=https%3A%2F%2Fgithub.com%2Fautosportlabs%2Farduino-esp32%2Ftree%2Fmaster%2Fidf_component_examples%2FHello_world"}},"totalCount":4,"showBranchInfobar":true},"fileTree":{"idf_component_examples":{"items":[{"name":"Hello_world","path":"idf_component_examples/Hello_world","contentType":"directory"}],"totalCount":1},"":{"items":[{"name":".github","path":".github","contentType":"directory"},{"name":"cores","path":"cores","contentType":"directory"},{"name":"docs","path":"docs","contentType":"directory"},{"name":"idf_component_examples","path":"idf_component_examples","contentType":"directory"},{"name":"libraries","path":"libraries","contentType":"directory"},{"name":"package","path":"package","contentType":"directory"},{"name":"tests","path":"tests","contentType":"directory"},{"name":"tools","path":"tools","contentType":"directory"},{"name":"variants","path":"variants","contentType":"directory"},{"name":".clang-format","path":".clang-format","contentType":"file"},{"name":".codespellrc","path":".codespellrc","contentType":"file"},{"name":".editorconfig","path":".editorconfig","contentType":"file"},{"name":".flake8","path":".flake8","contentType":"file"},{"name":".gitignore","path":".gitignore","contentType":"file"},{"name":".gitmodules","path":".gitmodules","contentType":"file"},{"name":".pre-commit-config.yaml","path":".pre-commit-config.yaml","contentType":"file"},{"name":".prettierignore","path":".prettierignore","contentType":"file"},{"name":".readthedocs.yaml","path":".readthedocs.yaml","contentType":"file"},{"name":".vale.ini","path":".vale.ini","contentType":"file"},{"name":"CMakeLists.txt","path":"CMakeLists.txt","contentType":"file"},{"name":"CODE_OF_CONDUCT.md","path":"CODE_OF_CONDUCT.md","contentType":"file"},{"name":"Kconfig.projbuild","path":"Kconfig.projbuild","contentType":"file"},{"name":"LICENSE.md","path":"LICENSE.md","contentType":"file"},{"name":"README.md","path":"README.md","contentType":"file"},{"name":"boards.txt","path":"boards.txt","contentType":"file"},{"name":"idf_component.yml","path":"idf_component.yml","contentType":"file"},{"name":"package.json","path":"package.json","contentType":"file"},{"name":"platform.txt","path":"platform.txt","contentType":"file"},{"name":"programmers.txt","path":"programmers.txt","contentType":"file"}],"totalCount":29}},"fileTreeProcessingTime":20.162221000000002,"foldersToFetch":[],"treeExpanded":true,"symbolsExpanded":false,"csrf_tokens":{"/autosportlabs/arduino-esp32/branches":{"post":"RhgCRtjwMiaP9L33jIexeXLESXBUzQOn1GiTDJA2sjm9z5F9VQwH4OI_VcakwufDNLXOgY9FgLKiwTbKqVpGwQ"},"/autosportlabs/arduino-esp32/branches/fetch_and_merge/master":{"post":"00h4wae8JtlQAD2XMcZRKnELW3Q3qzNpISaBXlXGpaiEX5hyZbUDLYPTCetA8LvTpUHgliuOsXWVn9YpdeyYQw"},"/autosportlabs/arduino-esp32/branches/fetch_and_merge/master?discard_changes=true":{"post":"Pxqx5WKlznJ71IM_98GtUq_H3sb9KVtMVrM9qmprCpZoDVFWoKzrhqgHt0OG90ere41lJOEM2VDiCmrdSkE3fQ"}}},"title":"arduino-esp32/idf_component_examples/Hello_world at master · autosportlabs/arduino-esp32","appPayload":{"helpUrl":"https://docs.github.com","findFileWorkerPath":"/assets-cdn/worker/find-file-worker-7d7eb7c71814.js","findInFileWorkerPath":"/assets-cdn/worker/find-in-file-worker-1ae9fa256942.js","githubDevUrl":null,"enabled_features":{"code_nav_ui_events":false,"react_blob_overlay":false,"accessible_code_button":true,"github_models_repo_integration":false}}}
0