Tuesday, May 24, 2022

Exp 4. Interface and control an LED with NODEMCU in online

 

Install ESP8266 Add-on in Arduino IDE

To install the ESP8266 board in your Arduino IDE, follow these next instructions:

 

1.  




In your Arduino IDE, go to File> Preferences

2.   Enter http://arduino.esp8266.com/stable/package_esp8266com_ind ex.json into the “Additional Boards Manager URLs” field as shown in the figure below. Then, click the “OK” button:


 

 



 

Note: if you already have the ESP32 boards URL, you can separate the URLs with a comma as follows:

https://dl.espressif.com/dl/package_esp32_index.json, http://arduino.esp8266.com/stable/package_esp8266com_index.json

 

3.   Open the Boards Manager. Go to Tools > Board > Boards Manager…


 

 



 

4.   Search for ESP8266 and press install button for the ESP8266 by ESP8266 Community“:



5.   That’s it. It should be installed after a few seconds.


 


 


 

1.   ESP8266 NodeMCU

2.   Breadboard

3.   LED

4.   Jumper Wires

5.   Arduino IDE

 

Step 3: Pin Connections


 


 

int pin =2;

 

voidsetup(){

// initialize GPIO 2 as an output. pinMode(pin, OUTPUT);

}

 

// the loop function runs over and over again forever voidloop(){

digitalWrite(pin, HIGH);// turn the LED on (HIGH is the voltage level) delay(1000);// wait for a second

digitalWrite(pin, LOW);// turn the LED off by making the voltage LOW delay(1000);// wait for a second

}

 

 

 

Having the right board name and COM port selected, follow these steps:

 

§  Hold-down the BOOT/FLASH button in your ESP8266 development board

§  Press the Upload button in the Arduino IDE to upload your sketch:


§  When you see the Connecting…. message in your Arduino IDE, release the finger from the “BOOT/FLASH button

§  After that, you should see the Done uploading message

Your ESP8266 should have the new sketch running. Press the ENABLE/RESET button to restart the ESP8266 and run the new uploaded sketch.

No comments:

Post a Comment

Control led light using remote

 // Include IR Remote Library by Ken Shirriff #include <IRremote.h> // Define sensor pin const int RECV_PIN = 4; // Define LED pin #de...