]> granicus.if.org Git - esp-idf/blob - examples/README.md
Merge branch 'feature/base_mac_address' into 'master'
[esp-idf] / examples / README.md
1 # Examples
2
3 This directory contains a growing number of simple example projects for esp-idf. These are intended to show basic esp-idf functionality, and to provide you can use for your own projects.
4
5 # Using Examples
6
7 Building examples is the same as building any other project:
8
9 * Follow the setup instructions in the top-level esp-idf README.
10
11 * Set `IDF_PATH` environment variable to point to the path to the esp-idf top-level directory.
12 * Change into the directory of the example you'd like to build.
13 * `make menuconfig` to configure the example. Most examples require a simple WiFi SSID & password via this configuration.
14 * `make` to build the example.
15 * Follow the printed instructions to flash, or run `make flash`.
16
17 # Copying Examples
18
19 Each example is a standalone project. The examples *do not have to be inside the esp-idf directory*. You can copy an example directory to anywhere on your computer in order to make a copy that you can modify and work with.
20
21 The `IDF_PATH` environment variable is the only thing that connects the example to the rest of the `esp-idf` system.
22
23 If you're looking for a more bare-bones project to start from, try [esp-idf-template](https://github.com/espressif/esp-idf-template).
24
25 # Contributing Examples
26
27 If you have a new example you think we'd like, please consider sending it to us as a Pull Request.
28
29 Please read the esp-idf CONTRIBUTING.rst file which lays out general contribution rules.
30
31 In addition, here are some tips for creating good examples:
32
33 * A good example is documented and the basic options can be configured.
34 * A good example does not contain a lot of code. If there is a lot of generic code in the example, consider refactoring that code into a standalone component and then use the component's API in your example.
35 * Names (of files, functions, variables, etc.) inside examples should be distinguishable from names of other parts of IDF (ideally, use `example` in names.)
36 * Functions and variables used inside examples should be declared static where possible.
37 * Examples should demonstrate one distinct thing each. Avoid multi-purposed "demo" examples, split these into multiple examples instead.
38 * Examples must be licensed under the Apache License 2.0 or (preferably for examples) if possible you can declare the example to be Public Domain / Creative Commons Zero.