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 17: Line 17:
=== Step 2: Find the COM Port ===
=== Step 2: Find the COM Port ===
# Plug in NodeMCU
# Plug in NodeMCU
# Open Command Prompt and type:
# Open Command Prompt and type: <code>mode</code>
<code>
mode
</code>
# Look for a line like <code>Status for device COM3:</code>
# Look for a line like <code>Status for device COM3:</code>



Revision as of 09:33, 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
  3. 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