Intro to NodeMCU and Arduino IDE

Intro to NodeMCU and Arduino IDE

The NodeMCU is a development board featuring the popular ESP8266 WiFi chip. As it turns out, you can program the ESP8266 just like any other microcontroller. Its obvious advantage over the Arduino or PIC is that it can readily connect to the Internet via WiFi. However, the ESP8266 breakout board has limited pins although the chip itself has a lot of output ports. The NodeMCU solves this problem by featuring 10 GPIO pins each capable of using PWM, I2C and 1-wire interface.
nodemcu v1.0
This ESP8266 development board really looks like an Arduino Nano. Speaking of Arduino, another advantage of this board is that you can connect it directly to your PC or Mac and program it like an Arduino! In fact, that's what I'm going to show you in this tutorial.
Here's how to program the NodeMCU using the Arduino IDE.

Step 1: Connect your NodeMCU to your computer

You need a USB micro B cable to connect the board. Once you plugged it in, a blue LED will start flashing. If your computer is not able to detect the NodeMCU board, you may need to download the driver on this page.

Step 2: Open Arduino IDE

You need to have at least Arduino IDE version 1.6.4 to proceed with this.
Go to File > Preferences. In the "Additional Boards Manager URLs" field, type (or copy-paste) http://arduino.esp8266.com/stable/package_esp8266com_index.json. Don't forget to click OK!
nodemcu-arduino-1
Then go to  Tools > Board > Board Manager. Type "esp8266" in the search field. The entry "esp8266 by ESP8266 Community" should appear. Click that entry and look for the install button on the lower right.
nodemcu-arduino-2
Once the download is complete, you can start coding!

Step 3: Make a LED blink using NodeMCU

For our first program, we'll blink a LED connected to one of the digital pins of the board. But before that, you need to know that the pin names printed on the board are not the pin names we'll be using for our program. BTW, I'm using NodeMCU V1.0. See my NodeMCU pinout article if you have the other versions of the board.
NodeMCUv1.0 Pinout
In this example, I'll connect the LED to D7 as it is printed on the board. D7 is GPIO13 according to the image above. And so here's my code (which is basically the example Blink code in Arduino):
Click the upload button and wait for the "Done Uploading" text to appear.
nodemcu blink
It's alive!
On my next post, we'll be controlling the LED via a web browser.
SHARE

Oscar perez

Arquitecto especialista en gestion de proyectos si necesitas desarrollar algun proyecto en Bogota contactame en el 3006825874 o visita mi pagina en www.arquitectobogota.tk

  • Image
  • Image
  • Image
  • Image
  • Image
    Blogger Comment
    Facebook Comment

0 comentarios:

Publicar un comentario