ESP32 Getting Started experience-windows

Source: Internet
Author: User
Tags idf

This post is suitable for entry-level personnel, but at the same time welcome new and old readers to criticize.

A treasure bought a esp32, there is a ESP32 development guide book.

And then the environment is built. The above is written mainly on Linux, I built a half-day on my orange Pi PC Development Board, there are some areas behind the problem, not ready. After the time to deal with the process, after all, an orange pie price is so low, plus a display price is not high, and it itself can be hardware programming, can also be used to learn a variety of programming ... It's a bit slow, but the entry level is definitely enough. Of course, if those A80, rk3399, can be cheaper, at least more than the micro-computer cheap words are good ... Pulled away.

So, I changed the window of the environment to build. Before there is a esp8266, only use it to play Micropython, now want to learn ESP32 programming words, in addition to use Micropython, will start again. And did not use eclipse before, set up a good environment after the long time matter to understand.

Now let me briefly explain my introductory process.

One: Win environment

I direct download of the An integrated development environment of the esp8266 (previously the letter was Ann can, so looked for a bit, sure enough to support ESP32). Ann can then find the development environment below: How to install an integrated development environment, how to use the integrated development environment of the Aisin ESP series, how to burn the firmware for ESP series module

Click in, follow the tutorial to download the file of the network disk, and then download Esp-idF, you can use the software you just downloaded cygwn software for git download, is the download directory Aithinkeride_v0.5\cygwin In the Cygwin.bat, the direct point opens, as follows:

Use the command terminal under Linux. It is recommended to use this git download, because I found ESP32 GitHub on a few direct download, unable to download, but can Git clone down, such as there is a ESP32 written in the NES game simulator!

CD to the file directory you want to download, enter git clone--recursive https://github.com/espressif/esp-idf download, note that git clone must add--recursive, Otherwise, all modules in the components directory cannot be pulled. CD in, LS enter can see the directory, as follows:

L COMPONENTS:ESP-IDF's core components

L DOCS:ESP-IDF Related documents

L EXAMPLES:ESP-IDF provides sample programs, including many peripherals, Wi-Fi, Bluetooth and other demo

L MAKE:EPS-IDF Project Management catalogue

L TOOLS:ESP-IDF offers a set of tools

Then it's best to create an app folder that will provide another sample program Git in.

The whole process is as follows:

The app folder is the main file you want to run, so you can write something yourself later. This example does not download Esp-idf-template can also.

The last line is used to make up the missing module (I also look at it from the Internet, just do it.) )

Then, point to open the IDE before the file, double hit open Esp_ide.exe, the first two are in the current directory, one by one open on the line, and the third is that you just downloaded the esp-idf file directory. Just select the folder you downloaded in the name ESP-IDF.

 

Okay, here's the play.

Open the Aithinker_ide.exe directly, then turn on Eclipse, and then click Import in the left margin to load your ESP-IDF project throughout. Detailed steps can refer to the network. (I copied the entire folder to a folder and opened it again.) )

Then to the left of the project's total directory right-click, (Bad) is the ESP-IDF directory right-click, select the bottom of the Propertie option, on the right side of C/c++build to modify the following address, as you put the Min function place (such as the previously established app, Note the folders included in the app folder after downloading).

Then, right-click on the left total directory

Select the Create option in Make Targets and add the following

Same step, get another build:

Before compiling, press SHIFT + F9 to bring up an option,

Choose after the dot build, compile one will jump out of an interface, generally only need to directly choose Exit launch just fine.

Then you can right-click on the left-hand side of the project to select Buil Project (if you've previously made a build, remember to clean it).

Well, the steps for a project are that way.

But what if you want to write a program of your own?

Let's start with the modification routines.

Copy all of the following files (three bars) to the app directory you just created, select Overwrite paste, then right-click on the left-hand ~\esp-idf\examples\get-started\hello_world, select Refresh to update, Now you can compile, but someone else's, (compile time is too long, if you want to experiment with your own code, or modify it first.) )

Its code is as follows:

1 /*Hello World Example2 3 This example code was in the public Domain (or CC0 licensed, at your option.)4 5 unless required by applicable law or agreed to writing, this6 software is distributed on a "as is" BASIS, without warranties OR7 CONDITIONS of any KIND, either express or implied.8 */9#include <stdio.h>Ten#include"Freertos/freertos.h" One#include"freertos/task.h" A#include"esp_system.h" -#include"esp_spi_flash.h" -  the  - voidApp_main () - { -printf"Hello world!\n");//serial Printing +  -     /*Print Chip Information*/ + esp_chip_info_t Chip_info; AEsp_chip_info (&chip_info); atprintf"This was ESP32 chip with%d CPU cores, wifi%s%s,", - Chip_info.cores, -(Chip_info.features & CHIP_FEATURE_BT)?"/BT":"", -(Chip_info.features & chip_feature_ble)?"/ble":""); -  -printf"Silicon revision%d,", chip_info.revision); in  -printf"%dMB%s flash\n", Spi_flash_get_chip_size ()/(1024x768*1024x768), to(Chip_info.features & Chip_feature_emb_flash)?"Embedded":"External"); +  -      for(inti =Ten; I >=0; i--) { theprintf"restarting in%d seconds...\n", i); *Vtaskdelay ( +/Porttick_period_ms); $     }Panax Notoginsengprintf"restarting now.\n"); - fflush (stdout); the Esp_restart ();//restart Option +}

Refer to the Gpio example under example for simple modification as follows:

1*Hello World Example2 3This example code is inchthe public Domain (or CC0 licensed, at your option.)4 5Unless required by applicable law or agreed toinchWriting This6Software isDistributed on an" as is"BASIS, without warranties OR7 CONDITIONS of any KIND, either express or implied.8*/9#include <stdio.h>Ten#include"Freertos/freertos.h" One#include"freertos/task.h" A#include"esp_system.h" -#include"esp_spi_flash.h" -  the  -#include <string.h> -#include <stdlib.h> -#include"Freertos/freertos.h" +#include"freertos/task.h" -#include"freertos/queue.h" +#include"driver/gpio.h" A  at #defineGpio_output_io_led 2 - #defineGpio_output_pin_sel ((1<<gpio_output_io_led)) - intI=0; - voidApp_main () - { -  in      //Initialize Gpio pin, copy directly from Gpio example - gpio_config_t io_conf; to         //Disable Interrupt +Io_conf.intr_type =gpio_pin_intr_disable; -         //Set as output mode theIo_conf.mode =Gpio_mode_output; *         //bit mask of the pins that want to Set,e.g.gpio2 $Io_conf.pin_bit_mask =Gpio_output_pin_sel;Panax Notoginseng         //Disable Pull-down mode -Io_conf.pull_down_en =0; the         //Disable pull-up mode +Io_conf.pull_up_en =0; A         //Configure GPIO with the given settings theGpio_config (&io_conf); +  -  $printf"Hello world!\n"); $  -     /*Print Chip Information*/ - esp_chip_info_t Chip_info; theEsp_chip_info (&chip_info); -printf"This was ESP32 chip with%d CPU cores, wifi%s%s,",Wuyi Chip_info.cores, the(Chip_info.features & CHIP_FEATURE_BT)?"/BT":"", -(Chip_info.features & chip_feature_ble)?"/ble":""); Wu  -printf"Silicon revision%d,", chip_info.revision); About  $printf"%dMB%s flash\n", Spi_flash_get_chip_size ()/(1024x768*1024x768), -(Chip_info.features & Chip_feature_emb_flash)?"Embedded":"External"); -  -    //for (int i = ten; I >= 0; i--) A      while(1) +     { the        //printf ("Restarting in%d seconds...\n", i); -Vtaskdelay ( +/Porttick_period_ms);//Delay $printf"I am zhinianzhizhan! \ n"); theprintf"Try to Study esp32\n"); theGpio_set_level (gpio_output_io_led, I%2);//The LED lights on the board are constantly flipping the IO to make it blink thei++; the         if(i>499) i=0; -     } in     //printf ("Restarting now.\n"); the  the    //fflush (stdout); About     //Esp_restart ();//Restart the function and the mask will not restart.  the}

Next, build. Long wait ... build success will show the following things:

After the build succeeds, it is downloaded.

Espressif official website can be found, address, download open, select Esp32 Download, and then the interface, according to the following selection of firmware, fill in the corresponding address, choose a good serial port, you can click to download.

1, 2, 3 is the choice to download the. bin file and (the address is not mistaken), three files are in the build folder.

Click in to see, so many folders?

Don't worry. First, choose bootloader inside the Bootloader.bin, the front tick, the back filled 0x1000,. Then the 23rd is in the build directory, exactly two, remember Partitions_singleapp.bin address fill 0x8000, their main file. Bin (Hello-world.bin here) is filled with the address 0x10000.

Then, the following options to choose the right (the default should be), and then follow your board plug in the USB port of the serial number selected to fill the COM port (do not know or the driver has not ann a bit, you can plug in the Driver wizard to install the driver, and then in the device management to view the COM number).

Finally, click Download. The latest downloader does not need to press the button on the board, download it yourself.

After the download is complete, the lower left corner of the downloader will become the word "finish", then you can connect the serial port, or press the EN key on the board directly, when the blue light flashes, and the serial port continuously outputs two lines of characters, the whole step is successful.

Of course, you can also see the serial output. Like using a serial hunter or something. I use is securecrt, very good, brush on the Micropython, this can be directly when the interface, and serial hunter and other software is either not, or input trouble. Recommend this, can Baidu search.

Well, first write here, and then slowly explore the development, and then write the tutorial.

  

ESP32 Getting Started experience-windows

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.