Nano esp32 RGBLED flashing, sketch not working

Hi everyone,
A couple weeks ago, i got a new Arduino - the nano esp32. It worked fine once i put myself in PLUGDEV group, but today, i had some trouble. I tried to upload the blink sketch to test, but it uploaded and now my arduino is cycling(RGB). Pls help, thanks.

Please post the sketch that you have uploaded to the board, using code tags when you do

In my experience the easiest way to tidy up the code and add the code tags is as follows

Start by tidying up your code by using Tools/Auto Format in the IDE to make it easier to read. Then use Edit/Copy for Forum and paste what was copied in a new reply. Code tags will have been added to the code to make it easy to read in the forum thus making it easier to provide help.

1 Like

Hello @128hacker, just a tiny addition - you can fully restore a Nano ESP32 using this guide. Let us know if this helps!

Hi @Iburelli, Thanks for advice. It was working for a couple days, but now it dosen't again. idk what happened. When following the guide you gave me, i got this error.

Sketch uses 295841 bytes (9%) of program storage space. Maximum is 3145728 bytes.
Global variables use 30912 bytes (9%) of dynamic memory, leaving 296768 bytes for local variables. Maximum is 327680 bytes.
python3 /home/minecraft/.arduino15/packages/esp32/tools/esptool_py/4.5.1/esptool.py --chip esp32s3 --port /dev/ttyACM0 --baud {upload.speed} {upload.flags} --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 80m --flash_size 16MB 0x10000 /tmp/arduino_build_78163/radar_ultrasonic.ino.bin 
usage: esptool [-h]
               [--chip {auto,esp8266,esp32,esp32s2,esp32s3beta2,esp32s3,esp32c3,esp32c6beta,esp32h2beta1,esp32h2beta2,esp32c2,esp32c6,esp32h2}]
               [--port PORT] [--baud BAUD]
               [--before {default_reset,usb_reset,no_reset,no_reset_no_sync}]
               [--after {hard_reset,soft_reset,no_reset,no_reset_stub}]
               [--no-stub] [--trace] [--override-vddsdio [{1.8V,1.9V,OFF}]]
               [--connect-attempts CONNECT_ATTEMPTS]
               {load_ram,dump_mem,read_mem,write_mem,write_flash,run,image_info,make_image,elf2image,read_mac,chip_id,flash_id,read_flash_status,write_flash_status,read_flash,verify_flash,erase_flash,erase_region,merge_bin,get_security_info,version}
               ...
esptool: error: argument --baud/-b: invalid arg_auto_int value: '{upload.speed}'
esptool: error: argument --baud/-b: invalid arg_auto_int value: '{upload.speed}'

Another update- now it works- kinda. Now, the light still flashes, but im able to enter bootloader mode, or the green pulsing led mode. in the mode, my pc can detect its Nano esp32, before it didn't, just said "/dev/ttyAMA0". Hope this helps you experts understand my situation!

It looks like you are using the ESP32 core by Espressif Systems. For the Arduino Nano ESP32, please make sure to use the Arduino ESP32 Boards package by Arduino in the Boards Manager.

I am using that board package you mentioned. I tried uploading from a mb air, but same problem.

What core, IDE version and OS are you using?
I can confirm the procedure works on Linux with the latest released IDE and Arduino ESP32 Boards core.

I am using raspbian/Raspberry Pi OS, IDE 1.8.19(legacy), and idk what core. And, if anyone has ideas on how to download the new ide on raspi, pls let me know!

Hi @128hacker. The error is caused by a difference in how the boards platform framework works in Arduino IDE 2.x vs 1.x.

When using Arduino IDE 2.x, the tools.esptool_py.program.pattern_args property defined in the "Arduino Nano ESP32" (machine identifier nano_nora) board definition:

overrides the global definition of the property:

When using Arduino IDE 1.x, this override does not occur.

I'll provide instructions you can follow to work around the Arduino IDE 1.x incompatibility:

  1. Select File > Quit from the Arduino IDE menus if the IDE is running.
    All Arduino IDE windows will close.
  2. Open any text editor.
  3. Add the following lines of text to the text editor:
    nano_nora.upload.speed=921600
    nano_nora.upload.flags=
    
  4. Save the file to the following path:
    /home/<username>/.arduino15/packages/arduino/hardware/esp32/2.0.13/boards.local.txt
    
    (Where <username> is your Linux username)
    :exclamation: The .arduino15` folder may be hidden by default in your file manager and terminal.
  5. Start Arduino IDE again.

Now try performing the "Reset the Arduino bootloader on the Nano ESP32" procedure again, just as you did before when you encountered that "invalid arg_auto_int value: '{upload.speed}'" error.

Unfortunately Arduino does not currently provide builds of Arduino IDE 2.x for Linux ARM hosts. The developers are tracking the need to provide builds for that host here:

A community member was producing unofficial Linux ARM builds of Arduino IDE 2.x for some time:

Unfortunately they stopped doing that recently so the newest version you can get from that repository is 2.2.0.

1 Like

ok thanks. But a question-should i edit the boards.txt file directly and add that code, or make a new file but put in same folder?

Either will work. I recommend using boards.local.txt for two reasons:

When you edit an existing platform configuration file, there is always the chance that you might inadvertently make changes to the existing content. If that happened, it could result in some difficult to troubleshoot problems. The use of boards.local.txt keeps the user's modifications isolated to a dedicated file and can always be easily reverted by clearing the optional file.

Using boards.local.txt makes it easy to reapply modifications after each update of the platform. Arduino will periodically make a new release of the "Arduino ESP32 Boards" platform and Arduino IDE will notify you of the availability of a new version and allow you to update it via Boards Manager. When you do that, all modifications you made to the previous version of the platform are lost and so you must reapply them after each update. If you keep a copy of your boards.local.txt file in a safe place. That post-update procedure is as simple as copying the file back into the platform installation folder and restarting Arduino IDE.

Thanks @ptillisch
That worked

You are welcome. I'm glad it is working now.

Regards,
Per

This is a modified RGB blink example. It works on the Nano esp32 RGBLED

int vDelay = 500;  //Controls blink speed of built in and RGB leds

void setup() {
  // put your setup code here, to run once:
  pinMode(LED_RED, OUTPUT);
  pinMode(LED_GREEN, OUTPUT);
  pinMode(LED_BLUE, OUTPUT);
  pinMode(LED_BUILTIN, OUTPUT);
}

void toggleLED() {
  if (digitalRead(LED_BUILTIN) == LOW){
    digitalWrite(LED_BUILTIN, HIGH);
  }
  else
  {
   digitalWrite(LED_BUILTIN, LOW);
  }
}

void loop() {
  //1
  toggleLED();
  digitalWrite(LED_RED, LOW);
  digitalWrite(LED_GREEN, LOW);
  digitalWrite(LED_BLUE, LOW);

  delay(vDelay);
//2
 toggleLED();
  digitalWrite(LED_RED, LOW);
  digitalWrite(LED_GREEN, LOW);
  digitalWrite(LED_BLUE, HIGH);

  delay(vDelay);
  //3
  toggleLED();
  digitalWrite(LED_RED, LOW);
  digitalWrite(LED_GREEN, HIGH);
  digitalWrite(LED_BLUE, LOW);

  delay(vDelay);
  //4
 toggleLED();
  digitalWrite(LED_RED, HIGH);
  digitalWrite(LED_GREEN, LOW);
  digitalWrite(LED_BLUE, LOW);

  delay(vDelay);
  //5
  toggleLED();
  digitalWrite(LED_RED, HIGH);
  digitalWrite(LED_GREEN, HIGH);
  digitalWrite(LED_BLUE, LOW);

  delay(vDelay);
  //6
 toggleLED();
  digitalWrite(LED_RED, HIGH);
  digitalWrite(LED_GREEN, LOW);
  digitalWrite(LED_BLUE, HIGH);

   delay(vDelay);
   //7
  toggleLED();
  digitalWrite(LED_RED, LOW);
  digitalWrite(LED_GREEN, HIGH);
  digitalWrite(LED_BLUE, HIGH);

  delay(vDelay);
  //8  Turns RGB LED completely Off
  /*
 toggleLED();
  digitalWrite(LED_RED, HIGH);
  digitalWrite(LED_GREEN, HIGH);
  digitalWrite(LED_BLUE, HIGH);
  
  delay(vDelay);
 */
}

no this isnt the problem. the problen is it blinks when the sketch dosent include blink. it is solved, but thanks.