text:
Sketch uses 33218 bytes (102%) of program storage space. Maximum is 32256 bytes?
I need to upload code on atmega328 wihout bootloader
https://github.com/EasyOne2030/test
but see Sketch uses 33218 bytes (102%) of program storage space. Maximum is 32256 bytes ?

If you eliminate the use of PPT_bits, you would have sufficient memory already. Alternative, you had 4 images representing RSSI, 5 images representing battery, and 3 images representing volume, if you eliminate one each, you would have sufficient memory also. If you insists to have all of them, then change the MCU to have bigger flash.

In the case where the size of the program (sketch) has become too large for the available program storage space (flash memory), there are a number of options. Note that this is not the same case as exceeding the amount of dynamic memory (RAM) which requires a different set of solutions.
_1. Microcontroller (MCU) upgrade.
This can be a solution. The closer
the architecture of the new MCU matches that that of the old MCU the
easier this is likely to be. However, this approach can become
complex, even when using a different MCU in the same series as the
original, if low level configuration of (and access to) hardware
peripherals such as timers, ports etc. has been used. Be aware that
any libraries used may not be compatible with the new MCU so testing
is important. In the worst case, there may be no supporting Arduino
core available for the new MCU. Major incompatibilities can be
tested with a simple compilation of a sketch for the new target MCU
and this does not even require the new MCU to be present.
In the
specific case of the ATmega328P, this is already the highest
specified MCU in its series so a new MCU is required to increase
resources such as Flash memory, RAM etc. An ATMega1284 may be a
possible replacement within the AVR range. Also to consider is an
ATmega4809 (newer megaAVR range) based board such as the Nano Every
but here there are more significant architectural differences
_2. Optimising the use of flash memory.
_2.1 Bootloader.
Sometimes, changing the bootloader for a smaller one can help. For example, with some Arduino Nanos, this can free 1.5KB of flash memory by changing to the same bootloader which is used on the Arduino Uno (Optiboot). Dropping the bootloader altogether and using an ISP programmer (or an Arduino configured as one) to program the MCU can also save flash memory. Here it is important to select an Arduino core which supports a "No Bootloader" option to achieve the maximum benefits from this approach. The core "Minicore" https://github.com/MCUdude/MiniCore is such an example. Important to note is the the Arduino IDE (base 1.8.19) has a special upload procedure when using a programmer (Sketch--> Upload using programmer).
Note also that the target (AVR) MCU must have the fuses correctly set for "no bootloader" operation. That is the fuse BOOTRST must be unset. This is achieved by using the "burn bootloader" option supplied by the core. Despite its (inappropriate) name this has the effect of setting the fuses. Alternatively, the fuses can be set manually using the AVRDUDE command line.
_2.2 General.
The compiler is quite good at optimising code however, it is important to be aware that the use of some program features can have a one time penalty when used. Examples are the String class, sprintf(), floating point handling etc. which force a large amount of code to be added to the compiled sketch. Some libraries can consume a large amount of program memory. Graphic libraries are notorious for this because often these include large font tables etc. Here the options are limited to looking for a lighter weight library or a hacking out unused parts of an existing library.

I need to upload code on atmega328 wihout bootloader

@onenext Download and install "MiniCore" from the location in the answer above. The readme.md there has a "how to install" section.
Once you have  correctly installed this, then from the Tools menu in the Arduino IDE select: Boards -> Minicore -> 328P. Again in the Tools menu, select the Bootloader Option and choose "No Bootloader". Once your sketch is ready to upload, you connect your programmer and use the special upload function under the sketch menu "Upload using Programmer". This procedure will give you an extra 256 bytes of program memory (flash).

I have  usbasp avr programmer and AVRDUDESS   Ineed hex file to uplod this code on atmega328 but When  export compiled binary  i see error message ........ Sketch uses 33198 bytes (102%) of program storage space. Maximum  is 32256 bytes.
Global variables use 966 bytes (47%) of dynamic memory, leaving 1082 bytes for local variables. Maximum is 2048 bytes ......   You can have a look at the original project   https://youtu.be/EPfLin7sqp4   ...

To recover the 512 bytes (my first comment incorrectly said 256) which is allocated to the bootloader, the recommendation is to use minicore. You do, however,  also have the option of hacking a new entry into the boards.txt file of the standard Arduino core, if you prefer. See:
https://forum.arduino.cc/t/boards-txt-definition-for-no-bootloader/630225

was unsuccessful

@onenext Which method did you try? Minicore or hacking boards.txt in the standard core? Did you fail to reduce the program size to 32,768 bytes or less or did the program fail to run after being uploaded? I can't try with your code because some local libraries are missing from the repository.

Minicore and  hacking boards.txt  Project files https://drive.google.com/file/d/1vLRAP2AkSIFmFd-1AyrlVtAfuOZqbbNy/view  How did he succeed .... https://youtu.be/EPfLin7sqp4 .... Please watch this  video

I've added an answer specifically related to Minicore, mainly because it may also help someone else. Much more I cannot do. I've used a test file and am not going to download the suggested RAR file. I've looked at the video (but don't speak Russian). However, (a) that is a project of considerable complexity so I guess your problems are only just starting (b) I notice its author has not responded positively to your style of  extremely brief problem reports.

Using Minicore  to compile and load a program onto an ATmega328P without a bootloader. Screen shots and sample output.
Resources used

CH340 ATmega328P Arduino Nano clone
A programmer (Nano based) running the Arduino ISP sketch
Minicore 2.1.3   https://github.com/MCUdude/MiniCore
Arduino IDE 1.8.19

/*
   Example sketch to use all flash memory of an ATmega328P
*/

const uint8_t bigArray[30121] PROGMEM = {0} ;

void setup() {
  Serial.begin( 115200 ) ;
  Serial.println("test-01" ) ;
  byte buffer = pgm_read_byte_near(bigArray+50); // stop compiler optimising the array away
  Serial.println(buffer ) ;
  pinMode(LED_BUILTIN, OUTPUT);
}

void loop() {
  digitalWrite(LED_BUILTIN, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);                       // wait for a second
  digitalWrite(LED_BUILTIN, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);                       // wait for a second
}

Select Board

Select Programmer

Select No Bootloader

Verify

Burn Bootloader /set fuses

Yes, even though you don't want a boot loader, you have to do this to correct the fuses (specifically, BOOTRST is unset by this procedure)
. . .
. . .
Writing | ################################################## | 100% 0.02s

avrdude: 1 bytes of lock written
avrdude: verifying lock memory against 0x0f:
avrdude: load data lock data from input file 0x0f:
avrdude: input file 0x0f contains 1 bytes
avrdude: reading on-chip lock data:

Reading | ################################################## | 100% 0.01s

avrdude: verifying ...
avrdude: 1 bytes of lock verified

avrdude done.  Thank you.

Upload Using Programmer

C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.57.0_x86__mdqgnx93n4wtt\arduino-builder -dump-prefs -logger=machine -hardware C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.57.0_x86__mdqgnx93n4wtt\hardware -hardware C:\Users\6v6gt\Documents\ArduinoData\packages -hardware C:\Users\6v6gt\Documents\Arduino\hardware -tools C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.57.0_x86__mdqgnx93n4wtt\tools-builder -tools C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.57.0_x86__mdqgnx93n4wtt\hardware\tools\avr -tools C:\Users\6v6gt\Documents\ArduinoData\packages -built-in-libraries C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.57.0_x86__mdqgnx93n4wtt\libraries -libraries C:\Users\6v6gt\Documents\Arduino\libraries -fqbn=MiniCore:avr:328:bootloader=no_bootloader,eeprom=keep,variant=modelP,BOD=2v7,LTO=Os,clock=16MHz_external -vid-pid=1A86_7523 -ide-version=10819 -build-path C:\Users\6v6gt\AppData\Local\Temp\arduino_build_577964 -warnings=all -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.avrdude.path=C:\Users\6v6gt\Documents\ArduinoData\packages\arduino\tools\avrdude\6.3.0-arduino18 -prefs=runtime.tools.avrdude-6.3.0-arduino18.path=C:\Users\6v6gt\Documents\ArduinoData\packages\arduino\tools\avrdude\6.3.0-arduino18 -prefs=runtime.tools.arduinoOTA.path=C:\Users\6v6gt\Documents\ArduinoData\packages\arduino\tools\arduinoOTA\1.3.0 -prefs=runtime.tools.arduinoOTA-1.3.0.path=C:\Users\6v6gt\Documents\ArduinoData\packages\arduino\tools\arduinoOTA\1.3.0 -prefs=runtime.tools.avr-gcc.path=C:\Users\6v6gt\Documents\ArduinoData\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7 -prefs=runtime.tools.avr-gcc-7.3.0-atmel3.6.1-arduino7.path=C:\Users\6v6gt\Documents\ArduinoData\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7 -verbose C:\Users\6v6gt\Documents\Arduino\big_flash_V0_01\big_flash_V0_01.ino
C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.57.0_x86__mdqgnx93n4wtt\arduino-builder -compile -logger=machine -hardware C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.57.0_x86__mdqgnx93n4wtt\hardware -hardware C:\Users\6v6gt\Documents\ArduinoData\packages -hardware C:\Users\6v6gt\Documents\Arduino\hardware -tools C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.57.0_x86__mdqgnx93n4wtt\tools-builder -tools C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.57.0_x86__mdqgnx93n4wtt\hardware\tools\avr -tools C:\Users\6v6gt\Documents\ArduinoData\packages -built-in-libraries C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.57.0_x86__mdqgnx93n4wtt\libraries -libraries C:\Users\6v6gt\Documents\Arduino\libraries -fqbn=MiniCore:avr:328:bootloader=no_bootloader,eeprom=keep,variant=modelP,BOD=2v7,LTO=Os,clock=16MHz_external -vid-pid=1A86_7523 -ide-version=10819 -build-path C:\Users\6v6gt\AppData\Local\Temp\arduino_build_577964 -warnings=all -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.avrdude.path=C:\Users\6v6gt\Documents\ArduinoData\packages\arduino\tools\avrdude\6.3.0-arduino18 -prefs=runtime.tools.avrdude-6.3.0-arduino18.path=C:\Users\6v6gt\Documents\ArduinoData\packages\arduino\tools\avrdude\6.3.0-arduino18 -prefs=runtime.tools.arduinoOTA.path=C:\Users\6v6gt\Documents\ArduinoData\packages\arduino\tools\arduinoOTA\1.3.0 -prefs=runtime.tools.arduinoOTA-1.3.0.path=C:\Users\6v6gt\Documents\ArduinoData\packages\arduino\tools\arduinoOTA\1.3.0 -prefs=runtime.tools.avr-gcc.path=C:\Users\6v6gt\Documents\ArduinoData\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7 -prefs=runtime.tools.avr-gcc-7.3.0-atmel3.6.1-arduino7.path=C:\Users\6v6gt\Documents\ArduinoData\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7 -verbose C:\Users\6v6gt\Documents\Arduino\big_flash_V0_01\big_flash_V0_01.ino
Using board '328' from platform in folder: C:\Users\6v6gt\Documents\ArduinoData\packages\MiniCore\hardware\avr\2.1.3
Using core 'MCUdude_corefiles' from platform in folder: C:\Users\6v6gt\Documents\ArduinoData\packages\MiniCore\hardware\avr\2.1.3
Detecting libraries used...
"C:\\Users\\6v6gt\\Documents\\ArduinoData\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-g++" -c -g -Os -w -std=gnu++17 -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10819 -DARDUINO_AVR_ATmega328 -DARDUINO_ARCH_AVR "-IC:\\Users\\6v6gt\\Documents\\ArduinoData\\packages\\MiniCore\\hardware\\avr\\2.1.3\\cores\\MCUdude_corefiles" "-IC:\\Users\\6v6gt\\Documents\\ArduinoData\\packages\\MiniCore\\hardware\\avr\\2.1.3\\variants\\standard" "C:\\Users\\6v6gt\\AppData\\Local\\Temp\\arduino_build_577964\\sketch\\big_flash_V0_01.ino.cpp" -o nul
Generating function prototypes...
"C:\\Users\\6v6gt\\Documents\\ArduinoData\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-g++" -c -g -Os -w -std=gnu++17 -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10819 -DARDUINO_AVR_ATmega328 -DARDUINO_ARCH_AVR "-IC:\\Users\\6v6gt\\Documents\\ArduinoData\\packages\\MiniCore\\hardware\\avr\\2.1.3\\cores\\MCUdude_corefiles" "-IC:\\Users\\6v6gt\\Documents\\ArduinoData\\packages\\MiniCore\\hardware\\avr\\2.1.3\\variants\\standard" "C:\\Users\\6v6gt\\AppData\\Local\\Temp\\arduino_build_577964\\sketch\\big_flash_V0_01.ino.cpp" -o "C:\\Users\\6v6gt\\AppData\\Local\\Temp\\arduino_build_577964\\preproc\\ctags_target_for_gcc_minus_e.cpp"
"C:\\Program Files\\WindowsApps\\ArduinoLLC.ArduinoIDE_1.8.57.0_x86__mdqgnx93n4wtt\\tools-builder\\ctags\\5.8-arduino11/ctags" -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives "C:\\Users\\6v6gt\\AppData\\Local\\Temp\\arduino_build_577964\\preproc\\ctags_target_for_gcc_minus_e.cpp"
Compiling sketch...
"C:\\Users\\6v6gt\\Documents\\ArduinoData\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-g++" -c -g -Os -Wall -Wextra -std=gnu++17 -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10819 -DARDUINO_AVR_ATmega328 -DARDUINO_ARCH_AVR "-IC:\\Users\\6v6gt\\Documents\\ArduinoData\\packages\\MiniCore\\hardware\\avr\\2.1.3\\cores\\MCUdude_corefiles" "-IC:\\Users\\6v6gt\\Documents\\ArduinoData\\packages\\MiniCore\\hardware\\avr\\2.1.3\\variants\\standard" "C:\\Users\\6v6gt\\AppData\\Local\\Temp\\arduino_build_577964\\sketch\\big_flash_V0_01.ino.cpp" -o "C:\\Users\\6v6gt\\AppData\\Local\\Temp\\arduino_build_577964\\sketch\\big_flash_V0_01.ino.cpp.o"
Compiling libraries...
Compiling core...
"C:\\Users\\6v6gt\\Documents\\ArduinoData\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-gcc" -c -g -x assembler-with-cpp -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10819 -DARDUINO_AVR_ATmega328 -DARDUINO_ARCH_AVR "-IC:\\Users\\6v6gt\\Documents\\ArduinoData\\packages\\MiniCore\\hardware\\avr\\2.1.3\\cores\\MCUdude_corefiles" "-IC:\\Users\\6v6gt\\Documents\\ArduinoData\\packages\\MiniCore\\hardware\\avr\\2.1.3\\variants\\standard" "C:\\Users\\6v6gt\\Documents\\ArduinoData\\packages\\MiniCore\\hardware\\avr\\2.1.3\\cores\\MCUdude_corefiles\\wiring_pulse.S" -o "C:\\Users\\6v6gt\\AppData\\Local\\Temp\\arduino_build_577964\\core\\wiring_pulse.S.o"
Using previously compiled file: C:\Users\6v6gt\AppData\Local\Temp\arduino_build_577964\core\hooks.c.o
Using previously compiled file: C:\Users\6v6gt\AppData\Local\Temp\arduino_build_577964\core\WInterrupts.c.o
Using previously compiled file: C:\Users\6v6gt\AppData\Local\Temp\arduino_build_577964\core\wiring.c.o
Using previously compiled file: C:\Users\6v6gt\AppData\Local\Temp\arduino_build_577964\core\wiring_shift.c.o
Using previously compiled file: C:\Users\6v6gt\AppData\Local\Temp\arduino_build_577964\core\wiring_digital.c.o
Using previously compiled file: C:\Users\6v6gt\AppData\Local\Temp\arduino_build_577964\core\wiring_analog.c.o
Using previously compiled file: C:\Users\6v6gt\AppData\Local\Temp\arduino_build_577964\core\wiring_pulse.c.o
Using previously compiled file: C:\Users\6v6gt\AppData\Local\Temp\arduino_build_577964\core\CDC.cpp.o
Using previously compiled file: C:\Users\6v6gt\AppData\Local\Temp\arduino_build_577964\core\HardwareSerial1.cpp.o
Using previously compiled file: C:\Users\6v6gt\AppData\Local\Temp\arduino_build_577964\core\HardwareSerial2.cpp.o
Using previously compiled file: C:\Users\6v6gt\AppData\Local\Temp\arduino_build_577964\core\HardwareSerial.cpp.o
Using previously compiled file: C:\Users\6v6gt\AppData\Local\Temp\arduino_build_577964\core\IPAddress.cpp.o
Using previously compiled file: C:\Users\6v6gt\AppData\Local\Temp\arduino_build_577964\core\PluggableUSB.cpp.o
Using previously compiled file: C:\Users\6v6gt\AppData\Local\Temp\arduino_build_577964\core\HardwareSerial3.cpp.o
Using previously compiled file: C:\Users\6v6gt\AppData\Local\Temp\arduino_build_577964\core\Stream.cpp.o
Using previously compiled file: C:\Users\6v6gt\AppData\Local\Temp\arduino_build_577964\core\Print.cpp.o
Using previously compiled file: C:\Users\6v6gt\AppData\Local\Temp\arduino_build_577964\core\HardwareSerial0.cpp.o
Using previously compiled file: C:\Users\6v6gt\AppData\Local\Temp\arduino_build_577964\core\Tone.cpp.o
Using previously compiled file: C:\Users\6v6gt\AppData\Local\Temp\arduino_build_577964\core\abi.cpp.o
Using previously compiled file: C:\Users\6v6gt\AppData\Local\Temp\arduino_build_577964\core\USBCore.cpp.o
Using previously compiled file: C:\Users\6v6gt\AppData\Local\Temp\arduino_build_577964\core\new.cpp.o
Using previously compiled file: C:\Users\6v6gt\AppData\Local\Temp\arduino_build_577964\core\main.cpp.o
Using previously compiled file: C:\Users\6v6gt\AppData\Local\Temp\arduino_build_577964\core\wiring_extras.cpp.o
Using previously compiled file: C:\Users\6v6gt\AppData\Local\Temp\arduino_build_577964\core\WMath.cpp.o
Using previously compiled file: C:\Users\6v6gt\AppData\Local\Temp\arduino_build_577964\core\WString.cpp.o
"C:\\Users\\6v6gt\\Documents\\ArduinoData\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-ar" rcs "C:\\Users\\6v6gt\\AppData\\Local\\Temp\\arduino_build_577964\\core\\core.a" "C:\\Users\\6v6gt\\AppData\\Local\\Temp\\arduino_build_577964\\core\\wiring_pulse.S.o"
"C:\\Users\\6v6gt\\Documents\\ArduinoData\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-ar" rcs "C:\\Users\\6v6gt\\AppData\\Local\\Temp\\arduino_build_577964\\core\\core.a" "C:\\Users\\6v6gt\\AppData\\Local\\Temp\\arduino_build_577964\\core\\WInterrupts.c.o"
"C:\\Users\\6v6gt\\Documents\\ArduinoData\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-ar" rcs "C:\\Users\\6v6gt\\AppData\\Local\\Temp\\arduino_build_577964\\core\\core.a" "C:\\Users\\6v6gt\\AppData\\Local\\Temp\\arduino_build_577964\\core\\hooks.c.o"
"C:\\Users\\6v6gt\\Documents\\ArduinoData\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-ar" rcs "C:\\Users\\6v6gt\\AppData\\Local\\Temp\\arduino_build_577964\\core\\core.a" "C:\\Users\\6v6gt\\AppData\\Local\\Temp\\arduino_build_577964\\core\\wiring.c.o"
"C:\\Users\\6v6gt\\Documents\\ArduinoData\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-ar" rcs "C:\\Users\\6v6gt\\AppData\\Local\\Temp\\arduino_build_577964\\core\\core.a" "C:\\Users\\6v6gt\\AppData\\Local\\Temp\\arduino_build_577964\\core\\wiring_analog.c.o"
"C:\\Users\\6v6gt\\Documents\\ArduinoData\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-ar" rcs "C:\\Users\\6v6gt\\AppData\\Local\\Temp\\arduino_build_577964\\core\\core.a" "C:\\Users\\6v6gt\\AppData\\Local\\Temp\\arduino_build_577964\\core\\wiring_digital.c.o"
"C:\\Users\\6v6gt\\Documents\\ArduinoData\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-ar" rcs "C:\\Users\\6v6gt\\AppData\\Local\\Temp\\arduino_build_577964\\core\\core.a" "C:\\Users\\6v6gt\\AppData\\Local\\Temp\\arduino_build_577964\\core\\wiring_pulse.c.o"
"C:\\Users\\6v6gt\\Documents\\ArduinoData\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-ar" rcs "C:\\Users\\6v6gt\\AppData\\Local\\Temp\\arduino_build_577964\\core\\core.a" "C:\\Users\\6v6gt\\AppData\\Local\\Temp\\arduino_build_577964\\core\\wiring_shift.c.o"
"C:\\Users\\6v6gt\\Documents\\ArduinoData\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-ar" rcs "C:\\Users\\6v6gt\\AppData\\Local\\Temp\\arduino_build_577964\\core\\core.a" "C:\\Users\\6v6gt\\AppData\\Local\\Temp\\arduino_build_577964\\core\\CDC.cpp.o"
"C:\\Users\\6v6gt\\Documents\\ArduinoData\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-ar" rcs "C:\\Users\\6v6gt\\AppData\\Local\\Temp\\arduino_build_577964\\core\\core.a" "C:\\Users\\6v6gt\\AppData\\Local\\Temp\\arduino_build_577964\\core\\HardwareSerial.cpp.o"
"C:\\Users\\6v6gt\\Documents\\ArduinoData\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-ar" rcs "C:\\Users\\6v6gt\\AppData\\Local\\Temp\\arduino_build_577964\\core\\core.a" "C:\\Users\\6v6gt\\AppData\\Local\\Temp\\arduino_build_577964\\core\\HardwareSerial0.cpp.o"
"C:\\Users\\6v6gt\\Documents\\ArduinoData\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-ar" rcs "C:\\Users\\6v6gt\\AppData\\Local\\Temp\\arduino_build_577964\\core\\core.a" "C:\\Users\\6v6gt\\AppData\\Local\\Temp\\arduino_build_577964\\core\\HardwareSerial1.cpp.o"
"C:\\Users\\6v6gt\\Documents\\ArduinoData\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-ar" rcs "C:\\Users\\6v6gt\\AppData\\Local\\Temp\\arduino_build_577964\\core\\core.a" "C:\\Users\\6v6gt\\AppData\\Local\\Temp\\arduino_build_577964\\core\\HardwareSerial2.cpp.o"
"C:\\Users\\6v6gt\\Documents\\ArduinoData\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-ar" rcs "C:\\Users\\6v6gt\\AppData\\Local\\Temp\\arduino_build_577964\\core\\core.a" "C:\\Users\\6v6gt\\AppData\\Local\\Temp\\arduino_build_577964\\core\\HardwareSerial3.cpp.o"
"C:\\Users\\6v6gt\\Documents\\ArduinoData\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-ar" rcs "C:\\Users\\6v6gt\\AppData\\Local\\Temp\\arduino_build_577964\\core\\core.a" "C:\\Users\\6v6gt\\AppData\\Local\\Temp\\arduino_build_577964\\core\\IPAddress.cpp.o"
"C:\\Users\\6v6gt\\Documents\\ArduinoData\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-ar" rcs "C:\\Users\\6v6gt\\AppData\\Local\\Temp\\arduino_build_577964\\core\\core.a" "C:\\Users\\6v6gt\\AppData\\Local\\Temp\\arduino_build_577964\\core\\PluggableUSB.cpp.o"
"C:\\Users\\6v6gt\\Documents\\ArduinoData\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-ar" rcs "C:\\Users\\6v6gt\\AppData\\Local\\Temp\\arduino_build_577964\\core\\core.a" "C:\\Users\\6v6gt\\AppData\\Local\\Temp\\arduino_build_577964\\core\\Print.cpp.o"
"C:\\Users\\6v6gt\\Documents\\ArduinoData\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-ar" rcs "C:\\Users\\6v6gt\\AppData\\Local\\Temp\\arduino_build_577964\\core\\core.a" "C:\\Users\\6v6gt\\AppData\\Local\\Temp\\arduino_build_577964\\core\\Stream.cpp.o"
"C:\\Users\\6v6gt\\Documents\\ArduinoData\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-ar" rcs "C:\\Users\\6v6gt\\AppData\\Local\\Temp\\arduino_build_577964\\core\\core.a" "C:\\Users\\6v6gt\\AppData\\Local\\Temp\\arduino_build_577964\\core\\Tone.cpp.o"
"C:\\Users\\6v6gt\\Documents\\ArduinoData\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-ar" rcs "C:\\Users\\6v6gt\\AppData\\Local\\Temp\\arduino_build_577964\\core\\core.a" "C:\\Users\\6v6gt\\AppData\\Local\\Temp\\arduino_build_577964\\core\\USBCore.cpp.o"
"C:\\Users\\6v6gt\\Documents\\ArduinoData\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-ar" rcs "C:\\Users\\6v6gt\\AppData\\Local\\Temp\\arduino_build_577964\\core\\core.a" "C:\\Users\\6v6gt\\AppData\\Local\\Temp\\arduino_build_577964\\core\\WMath.cpp.o"
"C:\\Users\\6v6gt\\Documents\\ArduinoData\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-ar" rcs "C:\\Users\\6v6gt\\AppData\\Local\\Temp\\arduino_build_577964\\core\\core.a" "C:\\Users\\6v6gt\\AppData\\Local\\Temp\\arduino_build_577964\\core\\WString.cpp.o"
"C:\\Users\\6v6gt\\Documents\\ArduinoData\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-ar" rcs "C:\\Users\\6v6gt\\AppData\\Local\\Temp\\arduino_build_577964\\core\\core.a" "C:\\Users\\6v6gt\\AppData\\Local\\Temp\\arduino_build_577964\\core\\abi.cpp.o"
"C:\\Users\\6v6gt\\Documents\\ArduinoData\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-ar" rcs "C:\\Users\\6v6gt\\AppData\\Local\\Temp\\arduino_build_577964\\core\\core.a" "C:\\Users\\6v6gt\\AppData\\Local\\Temp\\arduino_build_577964\\core\\main.cpp.o"
"C:\\Users\\6v6gt\\Documents\\ArduinoData\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-ar" rcs "C:\\Users\\6v6gt\\AppData\\Local\\Temp\\arduino_build_577964\\core\\core.a" "C:\\Users\\6v6gt\\AppData\\Local\\Temp\\arduino_build_577964\\core\\new.cpp.o"
"C:\\Users\\6v6gt\\Documents\\ArduinoData\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-ar" rcs "C:\\Users\\6v6gt\\AppData\\Local\\Temp\\arduino_build_577964\\core\\core.a" "C:\\Users\\6v6gt\\AppData\\Local\\Temp\\arduino_build_577964\\core\\wiring_extras.cpp.o"
Linking everything together...
"C:\\Users\\6v6gt\\Documents\\ArduinoData\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-gcc" -Wall -Wextra -Os -Wl,--gc-sections -mmcu=atmega328p -o "C:\\Users\\6v6gt\\AppData\\Local\\Temp\\arduino_build_577964/big_flash_V0_01.ino.elf" "C:\\Users\\6v6gt\\AppData\\Local\\Temp\\arduino_build_577964\\sketch\\big_flash_V0_01.ino.cpp.o" "C:\\Users\\6v6gt\\AppData\\Local\\Temp\\arduino_build_577964/core\\core.a" "-LC:\\Users\\6v6gt\\AppData\\Local\\Temp\\arduino_build_577964" -lm
"C:\\Users\\6v6gt\\Documents\\ArduinoData\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-objcopy" -O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0 "C:\\Users\\6v6gt\\AppData\\Local\\Temp\\arduino_build_577964/big_flash_V0_01.ino.elf" "C:\\Users\\6v6gt\\AppData\\Local\\Temp\\arduino_build_577964/big_flash_V0_01.ino.eep"
"C:\\Users\\6v6gt\\Documents\\ArduinoData\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-objcopy" -O ihex -R .eeprom "C:\\Users\\6v6gt\\AppData\\Local\\Temp\\arduino_build_577964/big_flash_V0_01.ino.elf" "C:\\Users\\6v6gt\\AppData\\Local\\Temp\\arduino_build_577964/big_flash_V0_01.ino.hex"
cmd /C "C:\\Users\\6v6gt\\Documents\\ArduinoData\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-objdump" --disassemble --source --line-numbers --demangle --section=.text "C:\\Users\\6v6gt\\AppData\\Local\\Temp\\arduino_build_577964/big_flash_V0_01.ino.elf" > "C:\\Users\\6v6gt\\AppData\\Local\\Temp\\arduino_build_577964/big_flash_V0_01.ino_atmega328p_16000000L.lst"
"C:\\Users\\6v6gt\\Documents\\ArduinoData\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-size" -A "C:\\Users\\6v6gt\\AppData\\Local\\Temp\\arduino_build_577964/big_flash_V0_01.ino.elf"
Sketch uses 32640 bytes (99%) of program storage space. Maximum is 32768 bytes.
Global variables use 196 bytes (9%) of dynamic memory, leaving 1852 bytes for local variables. Maximum is 2048 bytes.
C:\Users\6v6gt\Documents\ArduinoData\packages\arduino\tools\avrdude\6.3.0-arduino18/bin/avrdude -CC:\Users\6v6gt\Documents\ArduinoData\packages\MiniCore\hardware\avr\2.1.3/avrdude.conf -v -patmega328p -cstk500v1 -PCOM6 -b19200 -Uflash:w:C:\Users\6v6gt\AppData\Local\Temp\arduino_build_577964/big_flash_V0_01.ino.with_bootloader.hex:i

avrdude: Version 6.3-20201216
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "C:\Users\6v6gt\Documents\ArduinoData\packages\MiniCore\hardware\avr\2.1.3/avrdude.conf"

         Using Port                    : COM6
         Using Programmer              : stk500v1
         Overriding Baud Rate          : 19200
         AVR Part                      : ATmega328P
         Chip Erase delay              : 9000 us
         PAGEL                         : PD7
         BS2                           : PC2
         RESET disposition             : dedicated
         RETRY pulse                   : SCK
         serial program mode           : yes
         parallel program mode         : yes
         Timeout                       : 200
         StabDelay                     : 100
         CmdexeDelay                   : 25
         SyncLoops                     : 32
         ByteDelay                     : 0
         PollIndex                     : 3
         PollValue                     : 0x53
         Memory Detail                 :

                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           eeprom        65    20     4    0 no       1024    4      0  3600  3600 0xff 0xff
           flash         65     6   128    0 yes     32768  128    256  4500  4500 0xff 0xff
           lfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           hfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           efuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           lock           0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00

         Programmer Type : STK500
         Description     : Atmel STK500 Version 1.x firmware
         Hardware Version: 2
         Firmware Version: 1.18
         Topcard         : Unknown
         Vtarget         : 0.0 V
         Varef           : 0.0 V
         Oscillator      : Off
         SCK period      : 0.1 us

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.02s

avrdude: Device signature = 0x1e950f (probably m328p)
avrdude: NOTE: "flash" memory has been specified, an erase cycle will be performed
         To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file "C:\Users\6v6gt\AppData\Local\Temp\arduino_build_577964/big_flash_V0_01.ino.with_bootloader.hex"
avrdude: writing flash (32640 bytes):

Writing | ################################################## | 100% 35.80s

avrdude: 32640 bytes of flash written
avrdude: verifying flash memory against C:\Users\6v6gt\AppData\Local\Temp\arduino_build_577964/big_flash_V0_01.ino.with_bootloader.hex:
avrdude: load data flash data from input file C:\Users\6v6gt\AppData\Local\Temp\arduino_build_577964/big_flash_V0_01.ino.with_bootloader.hex:
avrdude: input file C:\Users\6v6gt\AppData\Local\Temp\arduino_build_577964/big_flash_V0_01.ino.with_bootloader.hex contains 32640 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 19.57s

avrdude: verifying ...
avrdude: 32640 bytes of flash verified

avrdude done.  Thank you.

Compiler LTO  when he chose  LTO enabled it work !  is this good ?

@onenext LTO = Link Time Optimisation. If the author of that project enabled it then you should also enable it.

the author of that project disabled it   thank you so much  I will try


text:
12V Relay not clicking
Trying to power the 12V relay from an Arduino to make an automatic cocktail maker.  Looking to power 12V water pumps off of the relay.  However, the relay is not clicking, only getting the light.
The connections FROM the Arduino TO the relay is as follows:

Arduino
Relay

5V
VCC

GND
GND

pin 3
IN1

Also pictures of circuit are provided. The Arduino is powered by USB laptop.

Have you set pin 3 to be an output?

What kind of relay or relay module are you using?

12V relay controlled by 5V arduino? You need a 5V relay or 12V supply for relay.

True, if you already connected the relay to pin 3, just test if the pin is still working as it might have drawn too much current, you should use a 5v relay or a 12 volt power source with a transistor.

The O.P. had intended to include more than the one image, but their markdown had been mangled.  Corrected, you can see this answers the pinMode question by Majenko and gives at least some degree of answer for StarCat.

@SBF, the relay board image that wasn't rendering in the original post confirms for you.

The digitalWrite() commands in your code use “quoted” values (such as “LOW” and “HIGH”) for the second operand. I dont’t think that will work correctly. Try to use the conventional LOW and HIGH. For example digitalWrite(relay, HiGH).

Please see why we shouldn't post images of text :)

After search the internet,
i believe the 12v relay need 12v to click.
You may check these :
https://handtoolsforfun.com/how-to-connect-a-12v-relay-board-to-arduino/
https://www.instructables.com/Connecting-a-12V-Relay-to-Arduino/

The problem is, we have no idea which relay board is used. The first link you point to whoes a relay board that looks like the one in the question but then goes on to explain nothing about that boards’ particulars. It even shows a relay controlled by a transistor, without the optical isolators that are clearly on the board. However, I think these relay boards do need a +12V connection.

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/

sort: votes


text:
ATTiny85 won't boot if PIN2 is not pulled high
I had some problem setting up a working ATTiny85 outside of its development board.Connection on my breadboard:
pulled high (10K R)  -- 1  PIN 8  -- VCC (+5V)
     trouble here!!  -- 2  PIN 7  --
                     -- 3  PIN 6  -- LED
               GND   -- 4  PIN 5  --

as you can guess pins are referred to actual chip's pins enumeration.My simple test code:
void setup() {
  pinMode(1, OUTPUT);
}
void loop() {
  if (analogRead(A1) > 512) {
    digitalWrite(1, HIGH);
    delay(250);
    digitalWrite(1, LOW);
    delay(250);
  } else {
    digitalWrite(1, HIGH);
    delay(1000);
    digitalWrite(1, LOW);
    delay(1000);
  }
}

I'm using Arduino IDE v1.8.13 with digistump avrboards v1.6.7.
I flashed t85_default micronucleus v2.5 bootloader in my chip with fuses set to lfuse:0xe1, hfuse:0xdd, efuse:0xfe.The problem is that if I power the chip with PIN2 not pulled high it won't start execution of the code, it won't blink.  If it’s started from pulled high, it will start code about 5s after power on. If it’s started pulled low code won’t execute until is pulled high. As I pull high, even just for a second, PIN2 it will start blinking and executing code.
Is it normal? I think I have missed something.

Well, I've made some headway.  I hope to update this with something more helpful though.
I don't have a digispark or even the correct Zener diodes to replicate the necessary parts of it.  However, I did install t85_default.hex on an ATTiny85 with some alterations to the hex file to place break instructions in a few strategic places.  And then I ran avarice/debugwire against it.
The basic problem is that it's trying to tune the internal oscillator against the USB frames by looking at the D- pin.  Basically, it's stuck in tuneOsccal.
988  00001d06 <tuneOsccal>:
   1     1d06:       b3 9b           sbis    0x16, 3 ; 22
   2     1d08:       fe cf           rjmp    .-4             ; 0x1d06 <tuneOsccal>
   3     1d0a:       07 d0           rcall   .+14            ; 0x1d1a <countFrame>
...

So if you want to avoid this, you need to compile with that feature off, and there is a feature to do that.
I have not yet run one with this feature disabled.  But I did compile t85_default once, using make CONFIG=t85_default and found it necessary to remove the START_WITHOUT_PULLUP from the first line of the t85_default/bootloaderconfig.h file.
The code mentions the existence of OSCCAL_SAVE_CALIB, which lets you specify your own OSCCAL value, assuming the factory one for the chip isn't good enough for whatever reason.  But there doesn't seem to be any guidance on how you're supposed store it or where.  Looking at the code though, if enabled, you can see it loads the OSCCAL value from just before where the bootloader starts.
A simple way to put it there without messing with command-lines and linker scripts would be to just edit the the t85_default.hex that results from building with OSCCAL_SAVE_CALIB enabled, and add an extra record for setting the osccal value at the correct address, which I guess would be 0x19FA, so:
:0119FA00XXSS
Where XX is whatever you've determined your OSCCAL value is and SS is the checksum value, or 0x100 - ((0x14 + XX) & 0xFF) in this case.  Or, if you want to be lazy, put whatever you want for SS and let AVRDude complain tell you what it's supposed to be when it tries to load the .hex file.  It will report the expected value in decimal, which you can convert to hex and patch into the file, and run AVRDude again.

Wow, this is very complicated for my level of understanding, but thanks to references you put in the answer I got the point. It would be kind of difficult for me to edit code given that I don't know assembly and I have a superficial knowledge of c++. For now I think I just start it with pin2 pulled high, then I will try to patch the hex file as you suggested. BTW I think you did a great job with this answer. Thank you.

I will look into making some short instructions.  You won't need to know assembly at all.  The first step would be to just use the standard osccal calibrations and see if that does the job, which wouldn't involve editing the hex file at all.  I may try to get set up to actually attach to USB, which may take quite a while.  Longer than you might think.

@ZenoDallaValle, I have what amounts to a digispark clone (or rather kit) coming that uses a socketed ATTiny85.  When I get it (which may be a while) and assemble it, I'll see about updating the answer with the process used.

I had the same problem, I changed to firmware micronucleus-1.11-upgrade.hex (from 2.3 to 1.11) and it was solved, you can find ir here https://github.com/micronucleus/micronucleus/tree/v1.11/upgrade/releases

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/


text:
Arduino (line follower + ultrasonic sensor + servomotor)
I am making a line follower car that follows the line when push button is pressed. And by using ultrasonic sensor I want the car to stop when object ahead distance is closer than 100 and then make servo motor turn to 180 degrees.
Used:

Arduino UNO
2 DC motor
cytron maker line sensor
1 servo motor
1 ultrasonic sensor
1 push button.

Got stuck coding, I would like some help please.
int E1 = 4;
int M1 = 5; // Right
int M2 = 6; // Left
int E2 = 7;
int trigPin = 4;
int echoPin = 5;

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

  pinMode(E1, OUTPUT);
  pinMode(M1, OUTPUT);
  pinMode(E2, OUTPUT);
  pinMode(M2, OUTPUT);

  digitalWrite(E1, HIGH);
  digitalWrite(E2, HIGH);

  pinMode(trigPin, OUTPUT);
  pinMode(echoPin, INPUT);
}

void loop() {
  float duration, distance;

  digitalWrite(trigPin, LOW);
  delayMicroseconds(2);
  digitalWrite(trigPin, HIGH);
  delayMicroseconds(10);
  digitalWrite(trigPin, LOW);

  duration = pulseIn(echoPin, HIGH);
  distance = ((float)(340 * duration) / 1000) / 2;

  Serial.print("\nDIstance:");
  Serial.print(distance);
  Serial.println("mm\n");
  delay(200);

  int D1 = digitalRead(8);
  int D2 = digitalRead(9);
  int D3 = digitalRead(10);
  int D4 = digitalRead(11);
  int D5 = digitalRead(12);

  if (D1 == 0 && D2 == 0 && D3 == 1 && D4 == 0 && D5 == 0) {
    analogWrite(M1, 100);
    analogWrite(M2, 100);
  }
  else if (D1 == 0 && D2 == 1 && D3 == 1 && D4 == 0 && D5 == 0) {
    analogWrite(M1, 80);
    analogWrite(M2, 100);
  }
  else if (D1 == 0 && D2 == 1 && D3 == 0 && D4 == 0 && D5 == 0) {
    analogWrite(M1, 60);
    analogWrite(M2, 100);
  }
  else if (D1 == 1 && D2 == 1 && D3 == 0 && D4 == 0 && D5 == 0) {
    analogWrite(M1, 30);
    analogWrite(M2, 100);
  }
  else if (D1 == 1 && D2 == 0 && D3 == 0 && D4 == 0 && D5 == 0) {
    analogWrite(M1, 0);
    analogWrite(M2, 100);
  }
  else if (D1 == 0 && D2 == 0 && D3 == 1 && D4 == 1 && D5 == 0) {
    analogWrite(M1, 100);
    analogWrite(M2, 80);
  }
  else if (D1 == 0 && D2 == 0 && D3 == 0 && D4 == 1 && D5 == 0) {
    analogWrite(M1, 100);
    analogWrite(M2, 60);
  }
  else if (D1 == 0 && D2 == 0 && D3 == 0 && D4 == 1 && D5 == 1) {
    analogWrite(M1, 100);
    analogWrite(M2, 30);
  }
  else if (D1 == 0 && D2 == 0 && D3 == 0 && D4 == 0 && D5 == 1) {
    analogWrite(M1, 100);
    analogWrite(M2, 0);
  }
  else if (D1 == 0 && D2 == 0 && D3 == 0 && D4 == 0 && D5 == 0) {
    analogWrite(M1, 0);
    analogWrite(M2, 0);
  }
  else if (D1 == 1 && D2 == 1 && D3 == 1 && D4 == 1 && D5 == 1) {
    analogWrite(M1, 00);
    analogWrite(M2, 00);
  }
  else {
  }
}

Stuck how? What's the specific issue?

(Unrelated, but consider naming things to be a bit more descriptive, e.g., if you have to comment M1 with right just name it rightMotor or something :) Might also be convenient to move some of the code out of loop into separate functions to help figure out what's going on.)

this coding doesn't detect the distance it prints 0 everytime I'm guessing if it is in the wrong order

int M1 = 5; // Right
...
int echoPin = 5;

You appear to be trying to use one of your motors on the same pin as your return signal from the ultrasonic range finder.  When analogWrite(M1, whatever), the internals of analogWrite will set the pin to output, overriding your own pinMode(echoPin, INPUT) in setup().
Later when you pulseIn(echoPin, HIGH), you're just seeing whatever analogWrite is doing with it.  If you're not touching any buttons, your code is executing analogWrite(M1, 0);, so no "distance".
For more fun:  If all of this is correct, if you hold down the buttons to execute analogWrite(M1, 100), pulseIn should report a value of about (1.0/980) * 100/256 or 399.  The 980 being the frequency pin 5 uses on the UNO for analogWrite.  This should cause your code to print something around 66.


text:
WS2812B LED strip + Arduino First Pixel keeps dying/breaking
I am trying too hook up a WS2812B LED strip to an Arduino Nano. The current strip consists of 6 pixels, and the whole thing is powered by a 5.26 V PC power supply.
The problem is that the first pixel keeps dying after about 1 minute. This means I have to cut the strip and re-solder the connections. Before the failure, the strip runs the correct examples from the FastLED package.

As this happened I looked for solutions. Adafruit's neopixel guide suggested:

adding a 1000 µF capacitor between ground and +5 V to cancel power peaks
adding a 300-500 Ω resistor between the strip_Data_in and D5

I had no 1000 µF+ Capacitor, so I used what I had, 470 µF, and installed it with the resistor.

This did not solve the problem. Another recommendation was to place a diode between the data and +5 V. I think this is to remove any power spikes in the data connection. With a good power supply this should not be necessary I guess, but it couldn't hurt. Another tip was to add a 100 kΩ resistor between data and ground.
Putting all mentioned above together gives something like this:

But in the end nothing changed. I tried alot of variations of solutions:

With and without condensator between ground and Vin.

With and without resistor between data and Arduino, and varied it between 220 Ω to 1 kΩ.

With and without the diodes. I tried connecting data with a diode to ground, +5 V, to both, and to none.

I have tried using a 3.7 V power source to see whether I could avoid burning the pixel. The LEDs had too little power to light up.

I have tried powering via the USB->Arduino->Arduino +5 V pin -> strip +5 V

Any idea where I might be fucking up?
I have burnt 30 pixels so far, with all the same result: blinking, tripping, and eventually failure. Removing the first LED always fixed the problem. This brand of LED strip did work on some other premade controller.
Some of my own ideas, of causes:

There really needs to be a 1000 µF capacitor. (I have never had trouble with voltage peaks with this powersupply, and this does not explain why the system fails after some time, instead of at plugin.)

EDIT 1:
I did some additional tests.

Raised the resistor before the data pin, from the recommended 470 Ω, as high as possible. I reached 8 kΩ (higher did not work). -> Same result, burned pixel

Lowered the voltage on the data input pin, with two resistances, one connected to ground. The LED strip only recognised data input when the 'Din_High' was above 3.5 V. Running at a bit lower voltage stopped the LEDs from recognising data. Yet still, same result -> burned pixel.

Changing the power supply: I changed the PC power supply to a 5 V power bank for loading celphones. The voltage this device was regulated to was between 5.2 and 4.8 V. The behaviour was the same -> burned pixel.

I would guess that IF:

the 5 V is stable and within 5.5 and 4.5 V and

The Din is within 0 and 5 V

The cable should be unable to break itself, right?

Powering via the usb cable is the safest. What was the result with just one rgb led and all the power from the usb 5v? You need another rgb led to compare, can you buy a normal rgb led? Some led controller chips (inside the rgb led) operate at 3.3v and a trick is used to make them work at 5v, perhaps the premade controller did something special to avoid to damage them. Can you show your power supply? If it is cheap and not allowed in your country, then you should not use it. For now, I think the combination of a non-standard led strip together with a cheap power supply might be the problem.

USB 2.0 only allows for 500mA.  It can be more, but that's the (assumed / agreed upon) limit if you are plugging into, for example, a lap top.  I would try a new / better 5 volt USB power supply.  One that can provide several Amps of power.  Guessing, those types of LED can take tens of mA.  Perhaps 60mA.  So 6 x 60mA is 360mA.  So I would at least get a supply that is double that.

In the third picture, take out the bridging jumper on 40. (last before the input pin of the led) Put another series resistor in place of the wire, from the input to the diodes. Also take a short wire and connect the ground track at the module (41) and connect it directly to 51 at the bottom of the Nano, duplicating the ground connection. Keep the wire short, not using premade jumper wires. This is in case you have a point on the breadboard that is not making adequate connections. Your wiring technique is as good as can be expected using a breadboard. A scope would be handy at this point.

does the first pixel flash green before it dies?

first pixel failure seems to indicate a problem with the data line .... the second pixel  is buffered by the first pixel ..... you could also try inserting a diode in series with the 5.26V power supply just to knock 0.6V off the voltage

the data line voltage has a range of -0.5V to VDD+0.5V ...... maybe the power voltage (VDD) drops to the point where the data line voltage is higher than 0.5V above VDD ..... maybe you need to use an open collector driver on the data line with a pullup resistor to VDD line

I found (a part of) the problem:
The soldered pin connections at start of the ribbon had leaking current. This was due to the soldering flux remaining around the pins. Rinsing the connection with water carefully solved the problem.
In earlier runs I soldered with flux and simply wiped it off afterwards. Also note that I am generous in flux usage. I do not know how people can make neat solderingwork without it.
Just scraping, and wiping with tissues between the connections is apparently unreliable. The flux is water solutable, said the package, so I used tap water for cleaning, but I also tried alcohol at times. Of course by taking care not to make anything wet besides the connection, and drying careful afterwards.
Obviously I checked the look of my soldering earlier as well, and it looked quite neat in my opinion. Yet measuring resistance between pins gave varying results, also compared with unsoldered, which made me wonder why.
Cleaning the area around the soldered pins seemed to remove this, which indicates that this may be due to the soldering flux that was remaining. I also heard that flux tends to start flowing again as it heats up under operation, which indicates why the connection seemed good right after soldering, but changed trough time.
Perhaps this is why people use these ultrasonic cleaning baths or something.
About the led strips:
They were one of the cheapest ones available.
About the power supplies:
The first power supply is the 5v line from a PC power supply, which should be able to give quite some amps. ( i forgot how much exactly, but way more than I needed)
The second power supply was a Lithion battery with regulator. The thing says it is able to supply 2 amps, but I stayed far away from this limit.
Thank you for your tips. You help me keep improving myself.
Any more tips on cleaning soldered connections are welcome.
EDIT:
Oh boi! If it isn't the consequences of my own actions!
So this is what SN39 flux does to soldered wires in 2 years. This is a different object, soldered with the same acid based flux thats intended for copper piping, and not for electricals. I have quite some wonky soldering work to replace at my job. Don't be me lads, and only use flux thats intended for electricals.

Very late note on this project, but nonetheless:
I found out that I used a soldering flux which was not suitable for electronics. (S39, which is an acid based flux, which should have been a resin based one)
It solders great but creates corrosion pretty quick, so hence is to be avoided.
Too bad that I never found replacing flux that solders so nice.
I am unsure if this is the cause of the pixels dying ,though.

https://www.kitronik.co.uk/pdf/WS2812B-LED-datasheet.pdf
Check the power supply. It is likely too high a voltage. 5.3V is the absolute max. The resistor is only to prevent signal reflections on long wire runs. Neither it or the diodes are needed for your setup.
For comparison, here are 4 rings of 43 WS2812B each, with only a 0.1uF cap per chip, each ring driven from a different data pin on an Uno, which is off screen, and a 10A power supply (4 rings x 43 LEDs/ring * 60mA/LED = 10.3A max current).
https://www.youtube.com/watch?v=CGOxbehyoM4
You can see the wires are much longer than yours.  Unfortunately the camera doesn't self adjust to the brightness changes too well, so the video can be a bit glary at times.

To my understanding, anything connected to the data line (resistors, diodes, etc) is there to protect to data pin from either sourcing too much current to the LEDs or receive a too high voltage.
The capacitor, on the other hand, is there to provide a buffer and maintain the voltage at the right value when current absorption increases with a spike.
If your LEDS burn up and it's always the first one, assuming they are all programmed to lit up of the same color, the most reasonable reason IMHO is you are feeding too much current, in particular in the form of higher voltage through the resistors on the strip.
I suggest you double check the source voltage with no load and with a light load, then try a different power supply and, as last resort, try to lower the brightness intensity of the LEDS: set brightness to 50% and check if it takes like 3 or 4 times longer to burn the LED, which will be a confirmation about my statement.
The first LED is the one receiving the highest voltage in the strip as the strip itself has a non trivial resistance, especially the cheap ones. Lowering the brightness you are actually lowering the amount of time the LED is on and it should prolong the LED life in a non linear way.
If my assumption is correct, this also means you have already partially damaged all the LEDS on the strip, the closer to the power, the more damaged they are.

I HIGHLY doubt that there would be any significant voltage drop between adjacent LED modules on the strip. If there was that kind of loss then a strip of lights would never work as they do. The most likely point of damage would be to the control input. And there is a reason that Adafruit recommends adding series resistance to the input. It is known to be the weak point.

While you've tried a 470µF capacitor, it might be worth getting a 1000µF capacitor, as recommended. Capacitors help stabilize the power supply, especially during sudden current spikes.


text:
Trying to instantiate a DS3231 real-time clock within a library
I'm trying to write a library encapsulating things that I do with a DS3231 real time clock. I have managed to compile a sketch using the library, but it apparently blows up when attempting to call clock methods such as getTime().
Header:
// JBP_DS3231.h
#ifndef __JBP_DS3231_h__
#define __JBP_DS3231_h__

#include <SD.h>
#include "DS3231.h"
#include "Arduino.h"

class JBP_DS3231
{
  public:
    JBP_DS3231();
    String TimeStamp();
  private:
    DS3231* _realTimeClock;
};

#endif

cpp:
#include <JBP_DS3231.h>
#include <SD.h>
#include "DS3231.h"
#include "Arduino.h"

JBP_DS3231::JBP_DS3231() {
  String thisTime = "";

  _realTimeClock = &DS3231(SDA, SCL);

  Serial.println("About to try to get time from RTC."); // Last line we hear from.

  thisTime = _realTimeClock->getTimeStr();
  Serial.print("Time in constructor is: ");
  Serial.println(thisTime);
}

String JBP_DS3231::TimeStamp() {
  String timeStamp = "";

  Serial.println("In TimeStamp().");
  timeStamp = _realTimeClock->getDateStr(FORMAT_LONG, FORMAT_MIDDLEENDIAN, '/');
  Serial.print("Value of timestamp is: ");
  Serial.println(timeStamp);
  timeStamp.concat(" ");
  timeStamp.concat(_realTimeClock->getTimeStr());
  Serial.println(timeStamp);

  return timeStamp;
}

Script:
const String WHO_AM_I = "JBP_DS3231_library_test.ino";
const    int VERSION = 0;

#include <JBP_DS3231.h>

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

  JBP_DS3231 johnsRTC;
  Serial.println(johnsRTC.TimeStamp());
}

void loop() {
  return;
}

void AnnounceAwakening() {
  Serial.print("Sketch ");
  Serial.print(WHO_AM_I);
  Serial.print(" version ");
  Serial.print(VERSION);
  Serial.println(".");
  Serial.println("");
}

Define "blows up"...?

If all you want to do is to enhance what the existing DS3231 library can do I suggest you just extend the class (create your own class which inherits the existing class) and add your own functions to it.

Also, you will have to provide a link to the DS3231 library you are using. I found at least 3, and none of them appear to be the one you are using (judging by the constructors).

Library: http://www.rinkydinkelectronics.com/library.php?id=73

"blows up" means that no subsequent statements are executed after the first call to _realTimeClock->getDateStr().

You appear to be providing a pointer to a constructor, not to an object.  Either create a new object with new, or instantiate the object separately and provide the pointer to the object:
_realTimeClock = new DS3231(SDA, SCL);

Better still, extend the existing class and implement your own methods:
clsss JBP_DS3231 : public DS3231 {
    public:
        JBP_DS3231(uint8_t d, uint8_t c) : DS3231(d, c) {
            String thisTime = "";
            Serial.println("About to try to get time from RTC."); // Last line we hear from.

            thisTime = getTimeStr();
            Serial.print("Time in constructor is: ");
            Serial.println(thisTime);
        }

        String TimeStamp() {
            String timeStamp = "";

            Serial.println("In TimeStamp().");
            timeStamp = getDateStr(FORMAT_LONG, FORMAT_MIDDLEENDIAN, '/');
            Serial.print("Value of timestamp is: ");
            Serial.println(timeStamp);
            timeStamp.concat(" ");
            timeStamp.concat(getTimeStr());
            Serial.println(timeStamp);

            return timeStamp;
        }
};

void setup() {
    Serial.begin(115200);
    JBP_DS3231 myRTC(SDA, SCL);
    Serial.println(johnsRTC.TimeStamp());
}

void loop() {
}

(Note: untested)

For what I'm doing, extending the source class seems to be logical. I will attempt and report back, thank you.

Majenko, the example you gave is not in the form of a library. I attempted a few variations on; this gives me error: expected primary-expression before ',' token.
JBP_DS3231.h
class JBP_DS3231 : public DS3231 {
  public:
    JBP_DS3231(uint8_t, uint8_t) : DS3231(uint8_t, uint8_t);

JBP_DS3231.cpp
JBP_DS3231::JBP_DS3231(uint8_t _SDA, uint8_t _SCL) : DS3231(_SDA, _SCL) {


text:
Determining ArduinoJSON document size based on file size
I'm trying to effectively allocate a doc's size, based on the size of the file saved in flash of ESP8266. Is there a way?
For example: file.size() X 1.5

I would think it very much depends on what the content is. If you have a lot of string data then it can correlate quite well. If you have a lot of numeric data then I would imagine the internal representation could be a lot smaller than the textual file representation of the same data.

@Majenko Since some parameter files are stored on flash (which also can be change in future), one size's can be 256, and other is 1250. My goal is not to allocate max of all

There is unfortunately no way to predict the size of the JsonDocument from the file size alone.
As a workaround, I suggest that you allocate a very large memory pool and shrink  it after deserialization; like so:
DynamicJsonDocument doc(ESP.getMaxAllocHeap());
deserializeJson(doc, file);
doc.shrinkToFit();

Indeed, this program consumes more memory than strictly required, but only for a fraction of a second.
See also:

How to determine the capacity of the JsonDocument?
BasicJsonDocument::shrinkToFit()

Is only for DynamicJsonDocument?

@guyd shrinkToFit is available in BasicJsonDocument, too. But not in JsonDocument or StaticJsonDocument. See the docs to determine which one to use in your use case.

Depending on what is actually being done, the filtering feature may also be helpful.

@guyd, you asked how to determine the document size at run time, so StaticJsonDocument is not an option.


text:
Arduino OTA - difference between Arduino IDE and PlatformIO
I used to OTA sketches and data files using the ArduinoOTA and ESP32 sketch data Upload tools and the ESP32 devkit, for example when using the Arduino IDE.
Versions:

Arduino IDE- 1.8.19
ESP32 on Arduino IDE - 1.0.6
ArduinoOTA 1.0.9

Moving to PlatformIO-
Started a new project using the ESP32 devkit, ArduinoOTA was added from the registry to the project (also 1.0.9 as on Arduino IDE).
And now - when I tried to copy the BasicOTA example from the Arduino IDE's ArduinoOTA example, the compilation failed.
To make sure I don't have any library/version issues, I checked:

WiFi, ESPmDNS is part of builtin.
WiFiUdp was not found not inbuiltin,installed nor registry - not shown in dependency graph during compilation -- ??
ArduinoOTA used from registry.

#include <WiFi.h>
#include <ESPmDNS.h>
#include <WiFiUdp.h>
#include <ArduinoOTA.h>

const char* ssid = "dvirz_iot";
const char* password = "GdSd13100301";

void setup() {
  Serial.begin(115200);
  Serial.println("Booting");
  WiFi.mode(WIFI_STA);
  WiFi.begin(ssid, password);
  while (WiFi.waitForConnectResult() != WL_CONNECTED) {
    Serial.println("Connection Failed! Rebooting...");
    delay(5000);
    ESP.restart();
  }

  // Port defaults to 3232
  // ArduinoOTA.setPort(3232);

  // Hostname defaults to esp3232-[MAC]
  // ArduinoOTA.setHostname("myesp32");

  // No authentication by default
  // ArduinoOTA.setPassword("admin");

  // Password can be set with it's md5 value as well
  // MD5(admin) = 21232f297a57a5a743894a0e4a801fc3
  // ArduinoOTA.setPasswordHash("21232f297a57a5a743894a0e4a801fc3");

  ArduinoOTA
    .onStart([]() {
      String type;
      if (ArduinoOTA.getCommand() == U_FLASH)
        type = "sketch";
      else // U_SPIFFS
        type = "filesystem";

      // NOTE: if updating SPIFFS this would be the place to unmount SPIFFS using SPIFFS.end()
      Serial.println("Start updating " + type);
    })
    .onEnd([]() {
      Serial.println("\nEnd");
    })
    .onProgress([](unsigned int progress, unsigned int total) {
      Serial.printf("Progress: %u%%\r", (progress / (total / 100)));
    })
    .onError([](ota_error_t error) {
      Serial.printf("Error[%u]: ", error);
      if (error == OTA_AUTH_ERROR) Serial.println("Auth Failed");
      else if (error == OTA_BEGIN_ERROR) Serial.println("Begin Failed");
      else if (error == OTA_CONNECT_ERROR) Serial.println("Connect Failed");
      else if (error == OTA_RECEIVE_ERROR) Serial.println("Receive Failed");
      else if (error == OTA_END_ERROR) Serial.println("End Failed");
    });

  ArduinoOTA.begin();

  Serial.println("Ready");
  Serial.print("IP address: ");
  Serial.println(WiFi.localIP());
}

void loop() {
  ArduinoOTA.handle();
}

and got this compilation error:
 *  Executing task in folder esp32_OTA_from_scratch: platformio run --environment esp32dev

Processing esp32dev (platform: espressif32; board: esp32dev; framework: arduino)
-------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp32dev.html
PLATFORM: Espressif 32 (6.1.0) > Espressif ESP32 Dev Module
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (cmsis-dap) External (cmsis-dap, esp-bridge, esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES:
 - framework-arduinoespressif32 @ 3.20007.0 (2.0.7)
 - tool-esptoolpy @ 1.40500.0 (4.5.0)
 - toolchain-xtensa-esp32 @ 8.4.0+2021r2-patch5
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 34 compatible libraries
Scanning dependencies...
Dependency Graph
|-- ArduinoOTA @ 1.0.9
|-- ESPmDNS @ 2.0.0
|-- WiFi @ 2.0.0
Building in release mode
Compiling .pio/build/esp32dev/src/main.cpp.o
Building .pio/build/esp32dev/bootloader.bin
Generating partitions .pio/build/esp32dev/partitions.bin
esptool.py v4.5
Creating esp32 image...
Merged 1 ELF section
Successfully created esp32 image.
Compiling .pio/build/esp32dev/lib8f4/Update/HttpsOTAUpdate.cpp.o
Compiling .pio/build/esp32dev/lib8f4/Update/Updater.cpp.o
Compiling .pio/build/esp32dev/liba9d/WiFi/WiFi.cpp.o
Compiling .pio/build/esp32dev/liba9d/WiFi/WiFiAP.cpp.o
Compiling .pio/build/esp32dev/liba9d/WiFi/WiFiClient.cpp.o
Compiling .pio/build/esp32dev/liba9d/WiFi/WiFiGeneric.cpp.o
Archiving .pio/build/esp32dev/lib8f4/libUpdate.a
Indexing .pio/build/esp32dev/lib8f4/libUpdate.a
Compiling .pio/build/esp32dev/liba9d/WiFi/WiFiMulti.cpp.o
Compiling .pio/build/esp32dev/liba9d/WiFi/WiFiSTA.cpp.o
Compiling .pio/build/esp32dev/liba9d/WiFi/WiFiScan.cpp.o
Compiling .pio/build/esp32dev/liba9d/WiFi/WiFiServer.cpp.o
Compiling .pio/build/esp32dev/liba9d/WiFi/WiFiUdp.cpp.o
Compiling .pio/build/esp32dev/libc4b/FS/FS.cpp.o
Compiling .pio/build/esp32dev/libc4b/FS/vfs_api.cpp.o
Compiling .pio/build/esp32dev/lib263/SPI/SPI.cpp.o
Archiving .pio/build/esp32dev/liba9d/libWiFi.a
Indexing .pio/build/esp32dev/liba9d/libWiFi.a
Compiling .pio/build/esp32dev/lib494/SD/SD.cpp.o
Archiving .pio/build/esp32dev/lib263/libSPI.a
Indexing .pio/build/esp32dev/lib263/libSPI.a
Compiling .pio/build/esp32dev/lib494/SD/sd_diskio.cpp.o
Compiling .pio/build/esp32dev/lib494/SD/sd_diskio_crc.c.o
Compiling .pio/build/esp32dev/lib624/ArduinoOTA/InternalStorage.cpp.o
Archiving .pio/build/esp32dev/libc4b/libFS.a
Indexing .pio/build/esp32dev/libc4b/libFS.a
Compiling .pio/build/esp32dev/lib624/ArduinoOTA/InternalStorageAVR.cpp.o
Compiling .pio/build/esp32dev/lib624/ArduinoOTA/InternalStorageESP.cpp.o
Compiling .pio/build/esp32dev/lib624/ArduinoOTA/InternalStorageRP2.cpp.o
Archiving .pio/build/esp32dev/lib494/libSD.a
Indexing .pio/build/esp32dev/lib494/libSD.a
Compiling .pio/build/esp32dev/lib624/ArduinoOTA/InternalStorageSTM32.cpp.o
Compiling .pio/build/esp32dev/lib624/ArduinoOTA/OTAStorage.cpp.o
Compiling .pio/build/esp32dev/lib624/ArduinoOTA/WiFiOTA.cpp.o
Compiling .pio/build/esp32dev/lib624/ArduinoOTA/utility/rp2_flash_boot.c.o
Compiling .pio/build/esp32dev/lib624/ArduinoOTA/utility/stm32_flash_boot.c.o
Compiling .pio/build/esp32dev/lib6d4/ESPmDNS/ESPmDNS.cpp.o
Compiling .pio/build/esp32dev/FrameworkArduino/Esp.cpp.o
Archiving .pio/build/esp32dev/lib624/libArduinoOTA.a
Compiling .pio/build/esp32dev/FrameworkArduino/FirmwareMSC.cpp.o
Indexing .pio/build/esp32dev/lib624/libArduinoOTA.a
Compiling .pio/build/esp32dev/FrameworkArduino/FunctionalInterrupt.cpp.o
Compiling .pio/build/esp32dev/FrameworkArduino/HWCDC.cpp.o
Compiling .pio/build/esp32dev/FrameworkArduino/HardwareSerial.cpp.o
Archiving .pio/build/esp32dev/lib6d4/libESPmDNS.a
Indexing .pio/build/esp32dev/lib6d4/libESPmDNS.a
Compiling .pio/build/esp32dev/FrameworkArduino/IPAddress.cpp.o
Compiling .pio/build/esp32dev/FrameworkArduino/IPv6Address.cpp.o
Compiling .pio/build/esp32dev/FrameworkArduino/MD5Builder.cpp.o
Compiling .pio/build/esp32dev/FrameworkArduino/Print.cpp.o
Compiling .pio/build/esp32dev/FrameworkArduino/Stream.cpp.o
Compiling .pio/build/esp32dev/FrameworkArduino/StreamString.cpp.o
Compiling .pio/build/esp32dev/FrameworkArduino/Tone.cpp.o
Compiling .pio/build/esp32dev/FrameworkArduino/USB.cpp.o
Compiling .pio/build/esp32dev/FrameworkArduino/USBCDC.cpp.o
Compiling .pio/build/esp32dev/FrameworkArduino/USBMSC.cpp.o
Compiling .pio/build/esp32dev/FrameworkArduino/WMath.cpp.o
Compiling .pio/build/esp32dev/FrameworkArduino/WString.cpp.o
Compiling .pio/build/esp32dev/FrameworkArduino/base64.cpp.o
Compiling .pio/build/esp32dev/FrameworkArduino/cbuf.cpp.o
Compiling .pio/build/esp32dev/FrameworkArduino/esp32-hal-adc.c.o
Compiling .pio/build/esp32dev/FrameworkArduino/esp32-hal-bt.c.o
Compiling .pio/build/esp32dev/FrameworkArduino/esp32-hal-cpu.c.o
Compiling .pio/build/esp32dev/FrameworkArduino/esp32-hal-dac.c.o
Compiling .pio/build/esp32dev/FrameworkArduino/esp32-hal-gpio.c.o
Compiling .pio/build/esp32dev/FrameworkArduino/esp32-hal-i2c-slave.c.o
Compiling .pio/build/esp32dev/FrameworkArduino/esp32-hal-i2c.c.o
Compiling .pio/build/esp32dev/FrameworkArduino/esp32-hal-ledc.c.o
Compiling .pio/build/esp32dev/FrameworkArduino/esp32-hal-matrix.c.o
Compiling .pio/build/esp32dev/FrameworkArduino/esp32-hal-misc.c.o
Compiling .pio/build/esp32dev/FrameworkArduino/esp32-hal-psram.c.o
Compiling .pio/build/esp32dev/FrameworkArduino/esp32-hal-rgb-led.c.o
Compiling .pio/build/esp32dev/FrameworkArduino/esp32-hal-rmt.c.o
Compiling .pio/build/esp32dev/FrameworkArduino/esp32-hal-sigmadelta.c.o
Compiling .pio/build/esp32dev/FrameworkArduino/esp32-hal-spi.c.o
Compiling .pio/build/esp32dev/FrameworkArduino/esp32-hal-time.c.o
Compiling .pio/build/esp32dev/FrameworkArduino/esp32-hal-timer.c.o
Compiling .pio/build/esp32dev/FrameworkArduino/esp32-hal-tinyusb.c.o
Compiling .pio/build/esp32dev/FrameworkArduino/esp32-hal-touch.c.o
Compiling .pio/build/esp32dev/FrameworkArduino/esp32-hal-uart.c.o
Compiling .pio/build/esp32dev/FrameworkArduino/firmware_msc_fat.c.o
Compiling .pio/build/esp32dev/FrameworkArduino/libb64/cdecode.c.o
Compiling .pio/build/esp32dev/FrameworkArduino/libb64/cencode.c.o
Compiling .pio/build/esp32dev/FrameworkArduino/main.cpp.o
Compiling .pio/build/esp32dev/FrameworkArduino/stdlib_noniso.c.o
Compiling .pio/build/esp32dev/FrameworkArduino/wiring_pulse.c.o
Compiling .pio/build/esp32dev/FrameworkArduino/wiring_shift.c.o
Archiving .pio/build/esp32dev/libFrameworkArduino.a
Indexing .pio/build/esp32dev/libFrameworkArduino.a
Linking .pio/build/esp32dev/firmware.elf
Retrieving maximum program size .pio/build/esp32dev/firmware.elf
Checking size .pio/build/esp32dev/firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [=         ]   8.0% (used 26164 bytes from 327680 bytes)
Flash: [==        ]  24.6% (used 322233 bytes from 1310720 bytes)
Building .pio/build/esp32dev/firmware.bin
esptool.py v4.5
Creating esp32 image...
Merged 2 ELF sections
Successfully created esp32 image.
========================================================= [SUCCESS] Took 13.72 seconds =========================================================
 *  Terminal will be reused by tasks, press any key to close it.

 *  Executing task in folder esp32_OTA_from_scratch: platformio run --environment esp32dev

Processing esp32dev (platform: espressif32; board: esp32dev; framework: arduino)
-------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp32dev.html
PLATFORM: Espressif 32 (6.1.0) > Espressif ESP32 Dev Module
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (cmsis-dap) External (cmsis-dap, esp-bridge, esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES:
 - framework-arduinoespressif32 @ 3.20007.0 (2.0.7)
 - tool-esptoolpy @ 1.40500.0 (4.5.0)
 - toolchain-xtensa-esp32 @ 8.4.0+2021r2-patch5
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 34 compatible libraries
Scanning dependencies...
Dependency Graph
|-- ArduinoOTA @ 1.0.9
|-- ESPmDNS @ 2.0.0
|-- WiFi @ 2.0.0
Building in release mode
Compiling .pio/build/esp32dev/src/main.cpp.o
src/main.cpp: In lambda function:
src/main.cpp:39:22: error: 'class ArduinoOTAMdnsClass<WiFiServer, WiFiClient, WiFiUDP>' has no member named 'getCommand'
       if (ArduinoOTA.getCommand() == U_FLASH)
                      ^~~~~~~~~~
src/main.cpp:39:38: error: 'U_FLASH' was not declared in this scope
       if (ArduinoOTA.getCommand() == U_FLASH)
                                      ^~~~~~~
src/main.cpp: In function 'void setup()':
src/main.cpp:37:13: error: invalid use of 'void'
   ArduinoOTA
   ~~~~~~~~~~
     .onStart([]() {
     ~~~~~~~~^~~~~~~
       String type;
       ~~~~~~~~~~~~
       if (ArduinoOTA.getCommand() == U_FLASH)
       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         type = "sketch";
         ~~~~~~~~~~~~~~~~
       else // U_SPIFFS
       ~~~~~~~~~~~~~~~~
         type = "filesystem";
         ~~~~~~~~~~~~~~~~~~~~

       // NOTE: if updating SPIFFS this would be the place to unmount SPIFFS using SPIFFS.end()
       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       Serial.println("Start updating " + type);
       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     })
     ~~
src/main.cpp:49:6: error: expected primary-expression before ')' token
     })
      ^
src/main.cpp:52:6: error: expected primary-expression before ')' token
     })
      ^
src/main.cpp:60:6: error: expected primary-expression before ')' token
     });
      ^
src/main.cpp:62:20: error: no matching function for call to 'ArduinoOTAMdnsClass<WiFiServer, WiFiClient, WiFiUDP>::begin()'
   ArduinoOTA.begin();
                    ^
In file included from src/main.cpp:5:
.pio/libdeps/esp32dev/ArduinoOTA/src/ArduinoOTA.h:91:8: note: candidate: 'void ArduinoOTAMdnsClass<NetServer, NetClient, NetUDP>::begin(IPAddress, const char*, const char*, OTAStorage&) [with NetServer = WiFiServer; NetClient = WiFiClient; NetUDP = WiFiUDP]'
   void begin(IPAddress localIP, const char* name, const char* password, OTAStorage& storage) {
        ^~~~~
.pio/libdeps/esp32dev/ArduinoOTA/src/ArduinoOTA.h:91:8: note:   candidate expects 4 arguments, 0 provided
*** [.pio/build/esp32dev/src/main.cpp.o] Error 1
========================================================== [FAILED] Took 2.69 seconds ==========================================================

 *  The terminal process "platformio 'run', '--environment', 'esp32dev'" terminated with exit code: 1.
 *  Terminal will be reused by tasks, press any key to close it.

What could be the problem?

All I can see are three issues (plus possible some bonus ones)

You can't daisy chain callback setters like that, it returns void and it doesn't make any sense to have  void.onProgress... and those callbacks doesn't seems to fit current library, so you should just drop them completely.
There is no begin() without parameters. See examples.
In the library I can see only callback setters: beforeApply, onError and onStart
You might be missing #include <Arduino.h> (it doesn't have any preprocessor like ArduinoIDE that adds this to the first line without you knowing it
You might be missing some defines (you can compare Arduino compile commands and Pio one)

Anyway you should take a look into the examples (at least begin is there). Callbacks looks like they are taken from who knows where (probably different library or so).
But they definitely must be complete like:
ArduinoOTA.onStart([](){ /* started */ });
ArduinoOTA.onBeforeApply([](){ /* before aply */ });

EDIT:
After some searching the ArduinoOTA library is directly in esp32 core (google: "arduinoOTA onProgress esp32"), so you don't have to add any lib_deps for ArduinoOTA. Or more likely you shouldn't add any, and the correct library will be used then. If not, you'll have to copy (or download) correct library into lib/ subdirectory.

Hi @KIIV - How can you explain the fact that the example is taken from ArduinoOTA library (when using Arduino IDE), compiles and works as it should ??

Might be different library (or version). Sometimes the cores has libraries with them. You can always find its location and copy that library to the lib subdirectory in your project (and remove that lib_deps ArduinoOTA reference) to use correct version

If you check the ArduinoOTA library in Github it states that this library has not been tested on platformIO
Also note that not all functions are the same, parameters are different when you call in ArduinoIDE and on PlatformIO


text:
Arduino + ESP8266 to send MQTT messages
I'm wondering if an Arduino Uno (or any other 328 family) that connects via Serial to an ESP8266 can send MQTT messages, rather than AT commands.

I didn't use MQTT yet so I didn't try any of the following options. I only know they exist.

AT firmware version 2 has a set of AT commands for MQTT. But development of AT 2 for esp8266 was ended with version 2.2. It requires an esp8266 with a 4 MB flash.

a very old esp8266 firmware called ESPLink has support to register to a MQTT topic and then use it in Arduino with the EL-link library. (The main goal of the ESPLink firmware was OTA update for Uno)

PubSubClient library is a very popular Arduino library for MQTT. It works over any standard Arduino networking library. For esp8266 there are multiple options for a firmware+library combination. I can only recommend my WiFiEspAT library (all others have too many problems). WiFiEspAT works with AT firmware in esp8266. Best is to use AT 1.7.5 or the 'fake' AT firmware ESP_ATMod, which is an Arduino sketch.

The third option will take much more flash and RAM than the first two, but it is a standard and portable way. You can port it to other networking library or other MCU type.
EDIT: Another option is to write a sketch with MQTT for the esp8266 directly and communicate the data with Uno or not use the Uno at all.


text:
regarding ardunio error
Arduino: 1.8.13 (Windows 10), Board: "Arduino Uno"
c:\program files (x86)\arduino\hardware\tools\avr\bin../lib/gcc/avr/7.3.0/../../../../avr/bin/ar.exe: unable to rename 'core\core.a'; reason: Permission denied
exit status 1
Error compiling for board Arduino Uno.
continue error is coming having downloading over more than 15 times. How can i overcome this problem

Have you tried turning off your antivirus software for a single compilation? Described in this issue on github


text:
Using an ATTiny85 and DigiKeyboard.h, can I detect when USB HID is connected?
I am building a project to send HID keystrokes to a computer with an ATTiny85. I want to detect when the USB communication is working, in order to turn on a LED saying that everything is good. If USB stops working, I want a watchdog to turn the LED off. Ideally it would also attempt to reconnect automatically.
DigiUSB has the DigiUSB.available() method, but DigiKeyboard does not, and I can't seem to use both headers in the same program because of conflicts. How can I do this without DigiUSB?

I see, well I would like to figure out any way to determine the connection status, and I'm coming up short.

@jsotola it is specifically in reference to using the attiny85 with a Micronucleus bootloader being programmed from the Arduino IDE. Unfortunately, delving into the complexities of V-USB and DigiKeyboard/DigiUSB headers is beyond my skill set, so I'm posting to try and find someone who does know.

Well, that's slightly complicated. It appears as two different devices in Windows - when first plugged in, it shows up under libusb-win32 devices as Micronucleus, and then after the 5-second bootloader timeout that becomes disconnected and then it shows up as HID Keyboard. I haven't had an issue with it disconnecting randomly, but I'm attempting to think ahead in case such a thing did happen. For example, the board has a separate power input independent of the USB power, so if comms are lost and the board still has power, I want it to be able to detect that and provide an output.

some thoughts ... turn the LED on when the device is enumerated ... turn the LED off when the device misses getting polled a couple of times .... reset the device when the device misses getting polled 10 times or so


text:
Can you use Serial Port as a variable?
I am doing a project where, for troubleshooting reasons, I find myself often swapping components to different serial ports. Maybe one time it's in Serial, then in Serial1, maybe I need to try if software serial works.
But changing every line where Serial.print or Serial.write is written for the new port is a hassle and easy to screw up.
Would it be possible to either create a definition at the beginning of the code that lets me rename Serial to SensorSerial so just by changing that definition I am sure it will use the correct port?

Yes. The simplest way is with a preprocessor macro. Macros get replaced verbatim before compilation happens, so you can do something like:
#define MY_SERIAL Serial

void setup() {
    MY_SERIAL.begin(115200);
}

void loop() {
    MY_SERIAL.println(millis());
    delay(1000);
}

Yes, thank you, this is exactly what I was looking for

Majenko's answer is the right answer for your question. But to answer the title of the question, if you ever need to use different Arduino outputs and inputs as variable, most of them have common type Stream or Print. So it would be:
Stream& SensorSerial = Serial;

or
Stream* SensorSerial;
SensorSerial = &Serial;

The Arduino Stream classes hierachy:

Gave the answer to the other person because it fit more precisely what I meant. But this is really helpful to know for another part of the same project

This is actually how libraries do it and I consider it superior to the preprocessor solution.

More importantly this can be leveraged at run time to switch between &Serial, &Serial2 etc.  Macros are OK for compile time.

this should be the accepted answer.


text:
WS2812B are only white on custom board
I recently designed a board for an LED project. I am using WS2812B as the LED, and an ATMEGA328P-AU as the microcontroller. I also am using an arduino nano as my ISP and using "flash with programmer". When I flashed the FastLED blink example (Code below) the LED lit up as white and stayed white when it was supposed to flash red. I tried various examples and they all had the same outcome, just white. Am I missing a crucial component in my circuit (aside from some decoupling capacitors)? Is it a software problem?
#include <FastLED.h>

#define NUM_LEDS 1
#define DATA_PIN 5

// Define the array of leds
CRGB leds[NUM_LEDS];

void setup() {
     FastLED.addLeds<WS2812B, DATA_PIN, GRB>(leds, NUM_LEDS);  // GRB ordering is typical
}

void loop() {
  // Turn the LED on, then pause
  leds[0] = CRGB::Red;
  FastLED.show();
  delay(500);
  // Now turn the LED off, then pause
  leds[0] = CRGB::Black;
  FastLED.show();
  delay(500);
}

Sounds like a timing problem. Have you set your fuses to use the external 16MHz or is it still on the internal 1MHz (or 8MHz whatever the default is)?

@Majenko It was a timing thing! thank you for the suggestion! I burnt the bootloader onto the chip, then flashed the sketch and it fixed the problem!

Then yes, it was the fuses set wrong.

The WS2812B chips are very sensitive to timing. They rely on pulses being just the right length for things to work.
It is common if the timing is off that you just end up with white.
Since you have a blank chip that you have never put a bootloader on the fuses will be set wrongly for your configuration. By default a chip comes configured for the internal 8MHz oscillator. That means that everything will be running at half the speed.
You need to set the fuses to use the 16MHz crystal so that it matches the F_CPU setting of 16000000 in the board configuration. Either that or use a board configuration that expects to run at 8MHz.


text:
U-blox Neo-6M GPS module and RX LED of Arduino aren't blinking
I started recently working with a uBlox Neo 6M GPS module.
Connection between Arduino and GPS module....
Vcc pin --> 3.3V ,
Tx pin --> D2,
Rx pin --> D3,
Gnd --> Gnd

I tried with this code:
#include <SoftwareSerial.h>
// Choose two Arduino pins to use for software serial
int RXPin = 2;
int TXPin = 3;
//Default baud of NEO-6M is 9600
int GPSBaud = 9600;
// Create a software serial port called "gpsSerial"
SoftwareSerial gpsSerial(RXPin, TXPin);
void setup()
{
  // Start the Arduino hardware serial port at 9600 baud
  Serial.begin(9600);
  // Start the software serial port at the GPS's default baud
  gpsSerial.begin(GPSBaud);
}
void loop()
{
  // Displays information when new sentence is available.
  while (gpsSerial.available() > 0)
    Serial.write(gpsSerial.read());
}

About 2-3 hours, I was working with it.. But I do not get the GPS LED to blink, as well as my Arduino's RX LED. In serial monitor I didn't get any data. Is my gps module destroyed??

Are you indoor or outdoor?

your code is missing the part that sends data from the Serial to gpsSerial ... the NEO-6M gets no data

Are you sure your module will run on 3.3v ?  Some modules need 5v to run while some work on 3.3v.  Also, what Arduino board do you have ?  Most have 5v logic level pins. You must ensure that the logic level matches between module and arduino.


text:
USB issues when powering RPI3 from Arduino Nano Every
I'm powering on/off an RPI3 A+ with a high-side power switch controlled by arduino gpio. I'm switching with it the high side going to RPI PP2 pad.
It works for the first several times but after some (4-5) power cycles, say 15 mins apart, the usb devices attached to RPI won't work anymore, D+ stays high at 2.1V and I need to power cycle arduino to recover from this issue.
Can you help to root-cause this?
EDIT: RPI is powered off after normal OS shutdown. Also missed saying that 2.1V D+ value is seen at the USB hub attached to RPI

Not an answer to your question, but wanted to let you know there is a chance that powering down your RPI3 with out shutting down the OS first may corrupt your SDCard.

What are you powering off the RPI3's USB ports? Guessing, there might be a current limitation you are exceeding. For example, A USB 2.0 port is only required to supply 500mA. After that, many computers will limit current  by dropping the voltage to protect them selves.

Sorry, you said D+, not V+. Still, would be good to know what USB device is connected. Might also consider the consequences of interrupting the power USB devices. USB communications is very complex. If USB discovery fails, then there may be no subsequent USB communications. Try this: Upon detecting a failed state, unplug the USB peripheral and plug it back in again in an attempt to force a new USB discovery sequence of events.

I added details in the question

Please [edit] your question to add a schematic. -- Is the USB hub self-powered or bus-powered? The schematic should show that in the former case. -- Since you state that the connection between Arduino and RPi is just the high-side switch, what effect has the power cycle of the Arduino on this part of the circuit? You might need to measure, optimally with an oscilloscope. -- Does removing the high-side switch and power cycling manually the same way create the same effect?

It is the expected way to add clarifications to the question, don't be attempted to "answer" in comments. This is not a forum. To notify commenters, you can use the character "@" directly followed by user name, but only one per comment.


text:
Problems using SIM808 with Pro Mini
I'm having problems with my setup.
I'm trying to create a wind-speed system when you send an SMS to retrieve the correct wind speed as an SMS response.
I'm using a pro mini, connected by USB via FTDI, and a SIM808 module.
The SIM808 is connected to a mains supply and the LED status suggests it is connected to the network.
The SIM808 pins are as follows:
TX > Pin 9
RX > Pin 10
VMCU V IN > Power supply +
GND (the one under VMCU) > Power supply -
GND (under Li-on) > GND on the Arduino

I've tried lots of source code examples but nothing much seems to happen, this is the latest code I'm testing (the top part of the loop at least). In the serial monitor, it reports back the "Sim808 init error" over and over.
include <DFRobot_sim808.h>
include <SoftwareSerial.h>
define MESSAGE_LENGTH 160
char message[MESSAGE_LENGTH];
int messageIndex = 0;
char MESSAGE[300];
char lat[12];
char lon[12];
char wspeed[12];

char phone[16];
char datetime[24];

define PIN_TX 9
define PIN_RX 10
SoftwareSerial mySerial(PIN_TX,PIN_RX);
DFRobot_SIM808 sim808(&mySerial);//Connect RX,TX,PWR,

void sendSMS(); void getGPS(); void readSMS();

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

//******** Initialize sim808 module *************
while(!sim808.init()) {
  Serial.print("Sim808 init error\r\n");
  delay(1000);
}
delay(3000);

Serial.println("SIM Init success");

I hope someone can help as I've spent ages on this and had no luck.

Are you sure this is the code you are running? You code won't compile, e.g. it should be #define instead of define...

Your connection doesn't make any sense, how do you power the pro mini? It will be better for you to provide the drawing or picture of your connection.


text:
Weird result printing an array using a loop
first of all I'm sorry for my english.
My problem is that I want to use an array of numbers on a function, but I'm getting a weird result inside a for loop. Doing some tests I've seen that it happens even in the simplest sketch so I should be doing something wrong.
I've created a two level int and I want to iterate through the second level using a for loop. Outside the for loop all data gotten from that array is OK, but just inside the loop I'm just getting garbage as if the array was not initialized.
My simple sketch is this:
const int number_small[][14] PROGMEM = {
  {124, 124, 387, 387, 399, 399, 443, 443, 483, 483, 387, 387, 124, 124},
};

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

  Serial.print(String(number_small[0][0]) + "\n");
  Serial.print(String(number_small[0][1]) + "\n");
  Serial.print(String(number_small[0][2]) + "\n");
  Serial.print(String(number_small[0][3]) + "\n");
  Serial.print(String(number_small[0][4]) + "\n");
  Serial.print(String(number_small[0][5]) + "\n");
  Serial.print(String(number_small[0][6]) + "\n");
  Serial.print(String(number_small[0][7]) + "\n");
  Serial.print(String(number_small[0][8]) + "\n");
  Serial.print(String(number_small[0][9]) + "\n");
  Serial.print(String(number_small[0][10]) + "\n");
  Serial.print(String(number_small[0][11]) + "\n");
  Serial.print(String(number_small[0][12]) + "\n");
  Serial.print(String(number_small[0][13]) + "\n\n\n");

  for (int i = 0; i<14; i++){
    Serial.print("I: " + String(i) + " - " + String(number_small[0][i]) + "\n");
  }
}

void loop() {
}

And the output is:
124
124
387
387
399
399
443
443
483
483
387
387
124
124

I: 0 - 0
I: 1 - 184
I: 2 - 0
I: 3 - 1
I: 4 - 0
I: 5 - -18248
I: 6 - -18248
I: 7 - -18248
I: 8 - 0
I: 9 - 135
I: 10 - 0
I: 11 - 0
I: 12 - 769
I: 13 - 0

What I'm doing wrong?,
Thanks!!

Constants like String(number_small[0][0]) are optimized by compiler during the build (=compile time).
However that's not the case of loop. So you have to use specific functions for reading values from PROGMEM in the runtime:
for (int i = 0; i<14; i++){
  Serial.print("I: ");
  Serial.print(i);
  Serial.print(" - ");
  Serial.println((int)pgm_read_word(number_small[0]+i));
}

Btw: Don't use string concatenations. These are extremely hungry for the memory. See Majenko's article: The Evils of Arduino Strings

Hi, thanks for your answer!!. Just I've found the solution and I was posting it. And thanks for the suggestion about strings and the article.

I was sure that I was doing something wrong and yes... Finally I did another test (storing the array on SRAM instead on PROGMEM) and it worked, so I've changed my "research direction" and I've found the solution.
With my initial sketch I was reading the PROGMEM from outside the loop, but from inside the loop what i read is the SDRAM, so I've to use the pgm_read functions to force to read from PROGMEM, and now finally is working:

pgm_read_word(number_small[0] + i)

const int number_small[][14] PROGMEM = {
  {124, 124, 387, 387, 399, 399, 443, 443, 483, 483, 387, 387, 124, 124},
};

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

  Serial.print(String(number_small[0][0]) + "\n");
  Serial.print(String(number_small[0][1]) + "\n");
  Serial.print(String(number_small[0][2]) + "\n");
  Serial.print(String(number_small[0][3]) + "\n");
  Serial.print(String(number_small[0][4]) + "\n");
  Serial.print(String(number_small[0][5]) + "\n");
  Serial.print(String(number_small[0][6]) + "\n");
  Serial.print(String(number_small[0][7]) + "\n");
  Serial.print(String(number_small[0][8]) + "\n");
  Serial.print(String(number_small[0][9]) + "\n");
  Serial.print(String(number_small[0][10]) + "\n");
  Serial.print(String(number_small[0][11]) + "\n");
  Serial.print(String(number_small[0][12]) + "\n");
  Serial.print(String(number_small[0][13]) + "\n\n\n");

  int i;
  for (i = 0; i<14; i++){
    Serial.print("I: " + String(i) + " - " + String(pgm_read_word(number_small[0] + i)) + "\n");
  }
}

void loop() {
}

Thanks and greetings!!

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/


text:
Sending Strings from NRF24L01 to app
I want to send pushbutton status from the nrf24l01 module to the app named nrfConnect. I could only find libraries that allow me to send float values. How could I send String values to the app? Thank You!

nRF Connect is for Bluetooth LE devices, the nRF24L01+ is really not a Bluetooth Low Energy transceiver.
The best the nRF24L01+ can do is make a few Bluetooth LE advertisements but that's very finicky. Here's a long description how: https://dmitry.gr/index.php?r=05.Projects&proj=15&proj=11.%20Bluetooth%20LE%20fakery


text:
ESP8266 HttpClient recursive connections to URL to send sensor data
I am developing a project based in Arduino Nano and 2 sensors. In this projects is very important the energy because of the prototype is going to be powered by batteries or solar power.
In order to save energy in the
void loop(){....}

I am only getting the value of a temperature sensor continuously in a method that returns true / false.
When the method returns true, one relay is activated by Arduino, and it provides energy to the ESP8266-01 module and other sensor.
At this moment I need to connect the ESP8266 to WiFi network, and after the WiFi connection is successfully, I need to read other sensor value 50 times and make a connection with
client.connect(server, 80)

and send sensor data with GET method to upload every sensor value to server.
In this way I am able to send the first read, but for further sensor reads the connection to server gives error
My code resumed:
void setup(){
  // Setup sensors...
}

void initWifi(){
  // Open ESP8266 connection to WiFi network
}

boolean tempetarure_read(){
  // read continuously the temp sensor...
}

void loop(){
  if(tempetarure_read()){
    digitalWrite(relayPin, HIGH); //Open relay to give energy to ESP8266 module
    read_other_sensor_and_send_to_server();
    digitalWrite(relayPin, LOW); // Switch off the relay
  }
}

void read_other_sensor_and_send_to_server(){
  for (int x = 0; x < 50; x++) {
    string sensor_data = get_sensor_data();

    Serial.println();
    Serial.println("Starting connection to server...");
    // if you get a connection, report back via serial
    if (client.connect(server, 80)) {
        Serial.println("Connected to server");
        // Make a HTTP request
        //client.println("GET /asciilogo.txt HTTP/1.1");
        client.print("GET /sensor/store?");
        client.print(sensor_data);
        client.println(" HTTP/1.1");
        client.println("Host: my.server.com");
        client.println("Connection: close");
        client.println();
    }

    String res="";
    while (client.available()) {
        char c = client.read();
        res += c;
    }

    client.flush();
    client.stop();
    delay(1000);

  } // end for
}

I get
[WiFiEsp] Connecting to my.server.com
[WiFiEsp] >>> TIMEOUT >>>
[WiFiEsp] Disconnecting  3

but the module is connected to wifi and my.serever.com is online. Can anybody help me to solve this issue?
Thanks in advance

There is a better approach than using a relay, you may want to read my blog on how I use an ESP-01 as a wifi shield and how an Arduino as a sensor node can "wake" it up when it is time to send data.

BTW, the problem of your code is that when you switch on the ESP-01, ESP-01 by default sent out some boot msg at baud rate of 74880, so what you received on Serial is not what you want. Secondly, it take several seconds for ESP-01 to established a wifi connection.

this is a case for troubleshooting not for an answer. turn on more logging. if you have an USB-to-TTL adapter, you can use it to sniff the communication between Arduino and esp8266, to see the exchanged AT commands and responses. do you use SoftwareSerial? is it at 9600 baud? if you have AT firmware 1.7+ (SDK3), try my WiFiEspAT library.


text:
ESP8266 WiFiEspClient Disconnect 3 with GPS
I have recovered an old sketch (2 years ago) in which I used 2 DHT22 sensors and sent the values to an web app to store in database. The sketch works fine with a ES8266 module connected to an arduino uno. In my new project I am trying to do the same action, but sending GPS coordinates obtained with GPS NEO-6m module.
I have write a function that returns a string with the parameters as lat, lng, altitude, and others.
void loop(){
  gps_data = get_gps_data();

  // all code for wifi client sending
  ..........
  client.print("GET /reads/store?"+gps_data);
  .......
  .......
}
String get_gps_data(){
  // GPS capture function
  ...........
}

The function takes 5 second in get GPS information but I always get....
TIMEOUT>>>
Disconecting 3
and none call arrives to to web server
but if I change (for example..)
gps_data = "gps=1&lat=36.125471&lng=-4.478658.....";

the system works fine and send continuously the data, and if I put a delay before and after the gps the system works. If I take a value from DHT22, the code works too, but with the GPS the URL is not sent to the server.
Any idea?
Thank you in advance...

yes, the gps_data is not what you think it is

one is on hw Serial other on SoftwareSerial? do you use the WiFiEsp library? at what baud rate?


text:
Can we use serial.begin command anywhere in code?
When to use this command? What difference it would create if I add this command in loop function, setup function and declaration section?

You cannot call Serial.begin() in a declaration. Like any program
instruction, you can only use it from within a function. As stated in
Juraj's answer, you can call it as many times as you want. However,
most often it only makes sense to do this in setup(), in order to
initialize the serial link once and for all at the beginning of your
program. Why would you ever want to do this initialization multiple
times?
Thinking about it, I can see two possible scenarios:

Your UART is connected, through a suitable transceiver, to an RS-485
bus. You have several slaves on this bus that require different UART
configurations (different baud rates, or number of data bits, or
parity). Then, each time you want to address one slave, you first
set your UART to the configuration suitable for that particular
slave. In this kind of situation, however, it would be more
convenient to arrange for all the slaves to share the same UART
configuration, if at all possible.
Your UART is connected to a device that continually sends data you
are not interested in. This could be, e.g., a GPS module. Since you
don't want your program to be interrupted every time a character is
received, you keep the UART disabled. Only when you do want the data
you enable it with Serial.begin(), you read as much as you need,
then you disable it again with Serial.end().

There may be other situations, but I bet they are all quite atypical
scenarios. The common practice is to call Serial.begin() once in
setup(), and have the UART enable from there on.

Serial.begin sets the baud rate. And the baud rate is important to the other side of the line. You can use Serial.begin where you need it, only care that the other side of the line has that baud rate too.
I use Serial1.end and Serial1.begin to change the baudrate in a Firmata sketch for Uno WiFi. Some seconds after the start the sketch detects esp flashing sequence on Serial. If detected, the sketch switches the baudrate of Serial1 from Firmata's optimal 57600 to bridge the flashing of esp at 230400 baud.

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/