Jump to content

Uploading IoT Application From Command Line: Difference between revisions

From cognifront
Pooja (talk | contribs)
No edit summary
Pooja (talk | contribs)
No edit summary
Line 37: Line 37:
python -m esptool --port COM3 erase_flash
python -m esptool --port COM3 erase_flash
</code>
</code>


=== Notes ===
=== Notes ===
* Make sure the COM port matches the one detected
* Make sure the COM port matches the one detected

Revision as of 09:32, 6 June 2025

Upload Code to NodeMCU (ESP8266) Using CMD

Prerequisites

  1. Install Python from https://www.python.org/downloads (Check "Add Python to PATH")
  2. Install required tools:

pip install esptool pyserial

  1. Install Arduino IDE: https://www.arduino.cc/en/software

Step 1: Compile the Sketch

  1. Open the sketch in Arduino IDE
  2. Select board: NodeMCU 1.0 (ESP-12E Module) under Tools → Board
  3. Go to Sketch → Export Compiled Binary
  4. A .bin file will be generated in the sketch folder

Step 2: Find the COM Port

  1. Plug in NodeMCU
  2. Open Command Prompt and type:

mode

  1. Look for a line like Status for device COM3:

Step 3: Flash the Code

  1. Open CMD and go to the folder where the .bin file is located:

cd "C:\Users\YourName\Documents\Arduino\MySketch"

  1. Upload the binary to NodeMCU:

python -m esptool --port COM3 --baud 115200 write_flash 0x00000 MySketch.ino.bin

(Optional) Erase Flash Before Upload

python -m esptool --port COM3 erase_flash

Notes

  • Make sure the COM port matches the one detected