Error when uploading Nodemcu - esp8266

hi guys , can you solve my problems, when i tried to upload my code to node mcu, this is what happen

/usr/local/bin/arduino-cli compile --fqbn esp8266:esp8266:nodemcuv2:baud=115200,dbg=Disabled,eesz=4M,exception=disabled,ip=lm2f,lvl=None____,vt=flash,wipe=none,xtal=80 --build-cache-path /tmp --output-dir /tmp/3900381684/build --build-path /tmp/arduino-build-F2F687DDCC9F3A61C2313501E2087C40 /tmp/3900381684/Sistem_Monitoring_IOT_Solar_Tracker_dec09a

Sketch uses 409264 bytes (39%) of program storage space. Maximum is 1044464 bytes.

Global variables use 36480 bytes (44%) of dynamic memory, leaving 45440 bytes for local variables. Maximum is 81920 bytes.

Upload started

Programming with: Serial

Flashing with command:C:/Users/user/.arduino-create/esp8266/esptool/2.5.0-3-20ed2b9/esptool.exe -vv -cd nodemcu -cb 115200 -cp COM3 -ca 0x00000 -cf C:/Users/user/AppData/Local/Temp/arduino-create-agent1803529042/Sistem_Monitoring_IOT_Solar_Tracker_dec09a.bin

esptool v0.4.13-1-gf80ae31 - (c) 2014 Ch. Klippel ck@atelier-klippel.de

setting board to nodemcu

setting baudrate from 115200 to 115200

setting port from COM1 to COM3

setting address from 0x00000000 to 0x00000000

espcomm_upload_file

espcomm_upload_mem

error: Failed to open COM3

error: espcomm_open failed

error: espcomm_upload_mem failed

This is my code, and i upload it in arduino IOT Cloud thankss

/*
  Sketch generated by the Arduino IoT Cloud Thing "Untitled"
  https://create.arduino.cc/cloud/things/088889a9-392d-4737-a45d-0f857b0a1134

  Arduino IoT Cloud Variables description

  The following variables are automatically generated and updated when changes are made to the Thing

  float pitchY;
  float rollX;
  float temperature;
  float voltage;
  bool saklar;

  Variables which are marked as READ/WRITE in the Cloud Thing will also have functions
  which are called when their values are changed from the Dashboard.
  These functions are generated with the Thing and added at the end of this sketch.
*/
#include <SoftwareSerial.h>
#include "thingProperties.h"
#include <Wire.h>

// Pin RX dan TX pada NodeMCU
  const int RX_PIN = D9;
  const int TX_PIN = D10;

// Inisialisasi objek SoftwareSerial
SoftwareSerial mySerial(RX_PIN, TX_PIN);

void setup() {
  Serial.begin(9600);
  mySerial.begin(9600);

  // Fungsi untuk memproses data yang diterima
  mySerial.println("NodeMCU ESP8266 Initialized");
}

void loop() {
  if (mySerial.available()) {
    // Baca data yang diterima dari Arduino Mega
    String receivedData = mySerial.readStringUntil('\n');

    // Proses data yang diterima
    processData(receivedData);
  }
}

void processData(String data) {
  // Cari posisi masing-masing data dalam string
  int indexGx = data.indexOf("Gx:");
  int indexGy = data.indexOf("Gy:");
  int indexTemperature = data.indexOf("Temperature:");
  int indexVoltage = data.indexOf("Voltage:");

  // Jika semua data ditemukan
  if (indexGx != -1 && indexGy != -1 && indexTemperature != -1 && indexVoltage != -1) {
    // Ekstrak nilai Gx
    String GxString = data.substring(indexGx + 3, indexGy);
    rollX = GxString.toFloat();

    // Ekstrak nilai Gy
    String GyString = data.substring(indexGy + 3, indexTemperature);
    pitchY = GyString.toFloat();

    // Ekstrak nilai Temperature
    String TemperatureString = data.substring(indexTemperature + 12, indexVoltage);
    temperature = TemperatureString.toFloat();

    // Ekstrak nilai Voltage
    String VoltageString = data.substring(indexVoltage + 8, data.length() - 1);
    voltage = VoltageString.toFloat();

    // Lakukan sesuatu dengan nilai-nilai yang diekstrak
    // Misalnya, tampilkan nilai-nilai tersebut
    Serial.println("Received Data:");
    Serial.print("Gx: ");
    Serial.println(rollX);
    Serial.print("Gy: ");
    Serial.println(pitchY);
    Serial.print("Temperature: ");
    Serial.println(temperature);
    Serial.print("Voltage: ");
    Serial.println(voltage);

    // Tambahan: Anda dapat melakukan tindakan atau pengendalian berdasarkan nilai-nilai ini
    // Sebagai contoh, Anda dapat mengontrol sesuatu berdasarkan nilai suhu (TemperatureValue) atau tegangan (VoltageValue)
  } else {
    Serial.println("Invalid data format");
  }
}

Did you download the driver?

Check your device manager on windows.

Hope it helps.

What does that mean uploading it in arduino IOT clouds"?

Do you use some kind of online-service to compile the code?

Using an Arduino-IDE installed on my local harddisk
the upload-log looks like this

C:\Arduino-Pure-Portable\arduino-1.8.19\portable\packages\esp8266\tools\python3\3.7.2-post1/python3 
-I C:\Arduino-Pure-Portable\arduino-1.8.19\portable\packages\esp8266\hardware\esp8266\3.1.2/tools/upload.py 
--chip esp8266 --port COM5 --baud 115200 --before default_reset 
--after hard_reset write_flash 0x0 C:\Users\dipl-\AppData\Local\Temp\arduino_build_261914/sketch_dec22a.ino.bin 
esptool.py v3.0
Serial port COM5
Connecting....
Chip is ESP8266EX
Features: WiFi
Crystal is 26MHz
MAC: 5c:cf:7f:0b:11:50
Uploading stub...
Running stub...
Stub running...
Configuring flash size...
Auto-detected Flash size: 4MB
Flash params set to 0x0340
Compressed 270448 bytes to 198938...
Writing at 0x00000000... (7 %)
Writing at 0x00004000... (15 %)
Writing at 0x00008000... (23 %)
Writing at 0x0000c000... (30 %)
Writing at 0x00010000... (38 %)
Writing at 0x00014000... (46 %)
Writing at 0x00018000... (53 %)
Writing at 0x0001c000... (61 %)
Writing at 0x00020000... (69 %)
Writing at 0x00024000... (76 %)
Writing at 0x00028000... (84 %)
Writing at 0x0002c000... (92 %)
Writing at 0x00030000... (100 %)
Wrote 270448 bytes (198938 compressed) at 0x00000000 in 17.6 seconds (effective 123.0 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin...

which is very different from your log.

If I'm not mistaken, @ricardodivani is using the web editor given by the Arduino IoT cloud.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.