text:
The code is working fine with Arduino Uno but not with NodeMCU
I uploaded program MPU6050_DMP6_Multiple.ino (https://github.com/eadf/MPU6050_DMP6_Multiple/blob/master/MPU6050_DMP6_Multiple.ino) to Arduino Uno and it works fine.
When I upload the very same code to NodeMCU 1.0 board in Arduino IDE I have this message from the compiler :
Errors :
Arduino: 1.8.5 (Windows 7), Board: "NodeMCU 1.0 (ESP-12E Module), 80 MHz, 4M (3M SPIFFS), v2 Prebuilt (MSS=536), Disabled, None, 115200"

C:\Program Files (x86)\Arduino\arduino-builder -dump-prefs -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -hardware C:\Users\Pera\AppData\Local\Arduino15\packages -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -tools C:\Users\Pera\AppData\Local\Arduino15\packages -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries C:\Users\Pera\Documents\Arduinogttp\libraries -fqbn=esp8266:esp8266:nodemcuv2:CpuFrequency=80,FlashSize=4M3M,LwIPVariant=v2mss536,Debug=Disabled,DebugLevel=None____,UploadSpeed=115200 -ide-version=10805 -build-path C:\Users\Pera\AppData\Local\Temp\arduino_build_960938 -warnings=none -build-cache C:\Users\Pera\AppData\Local\Temp\arduino_cache_811066 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.xtensa-lx106-elf-gcc.path=C:\Users\Pera\AppData\Local\Arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\1.20.0-26-gb404fb9-2 -prefs=runtime.tools.mkspiffs.path=C:\Users\Pera\AppData\Local\Arduino15\packages\esp8266\tools\mkspiffs\0.2.0 -prefs=runtime.tools.esptool.path=C:\Users\Pera\AppData\Local\Arduino15\packages\esp8266\tools\esptool\0.4.12 -verbose C:\Program Files (x86)\Arduino\examples\14.Experiment\OrigMPU6050\OrigMPU6050.ino
C:\Program Files (x86)\Arduino\arduino-builder -compile -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -hardware C:\Users\Pera\AppData\Local\Arduino15\packages -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -tools C:\Users\Pera\AppData\Local\Arduino15\packages -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries C:\Users\Pera\Documents\Arduinogttp\libraries -fqbn=esp8266:esp8266:nodemcuv2:CpuFrequency=80,FlashSize=4M3M,LwIPVariant=v2mss536,Debug=Disabled,DebugLevel=None____,UploadSpeed=115200 -ide-version=10805 -build-path C:\Users\Pera\AppData\Local\Temp\arduino_build_960938 -warnings=none -build-cache C:\Users\Pera\AppData\Local\Temp\arduino_cache_811066 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.xtensa-lx106-elf-gcc.path=C:\Users\Pera\AppData\Local\Arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\1.20.0-26-gb404fb9-2 -prefs=runtime.tools.mkspiffs.path=C:\Users\Pera\AppData\Local\Arduino15\packages\esp8266\tools\mkspiffs\0.2.0 -prefs=runtime.tools.esptool.path=C:\Users\Pera\AppData\Local\Arduino15\packages\esp8266\tools\esptool\0.4.12 -verbose C:\Program Files (x86)\Arduino\examples\14.Experiment\OrigMPU6050\OrigMPU6050.ino
Using board 'nodemcuv2' from platform in folder: C:\Users\Pera\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.0
Using core 'esp8266' from platform in folder: C:\Users\Pera\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.0
Detecting libraries used...
"C:\Users\Pera\AppData\Local\Arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\1.20.0-26-gb404fb9-2/bin/xtensa-lx106-elf-g++" -D__ets__ -DICACHE_FLASH -U__STRICT_ANSI__ "-IC:\Users\Pera\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.0/tools/sdk/include" "-IC:\Users\Pera\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.0/tools/sdk/lwip2/include" "-IC:\Users\Pera\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.0/tools/sdk/libc/xtensa-lx106-elf/include" "-IC:\Users\Pera\AppData\Local\Temp\arduino_build_960938/core" -c -w -Os -g -mlongcalls -mtext-section-literals -fno-exceptions -fno-rtti -falign-functions=4 -std=c++11 -ffunction-sections -fdata-sections -w -x c++ -E -CC -DF_CPU=80000000L -DLWIP_OPEN_SRC -DTCP_MSS=536 -DARDUINO=10805 -DARDUINO_ESP8266_NODEMCU -DARDUINO_ARCH_ESP8266 -DARDUINO_BOARD="ESP8266_NODEMCU" -DESP8266 "-IC:\Users\Pera\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.0\cores\esp8266" "-IC:\Users\Pera\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.0\variants\nodemcu" "C:\Users\Pera\AppData\Local\Temp\arduino_build_960938\sketch\OrigMPU6050.ino.cpp" -o "nul"
"C:\Users\Pera\AppData\Local\Arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\1.20.0-26-gb404fb9-2/bin/xtensa-lx106-elf-g++" -D__ets__ -DICACHE_FLASH -U__STRICT_ANSI__ "-IC:\Users\Pera\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.0/tools/sdk/include" "-IC:\Users\Pera\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.0/tools/sdk/lwip2/include" "-IC:\Users\Pera\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.0/tools/sdk/libc/xtensa-lx106-elf/include" "-IC:\Users\Pera\AppData\Local\Temp\arduino_build_960938/core" -c -w -Os -g -mlongcalls -mtext-section-literals -fno-exceptions -fno-rtti -falign-functions=4 -std=c++11 -ffunction-sections -fdata-sections -w -x c++ -E -CC -DF_CPU=80000000L -DLWIP_OPEN_SRC -DTCP_MSS=536 -DARDUINO=10805 -DARDUINO_ESP8266_NODEMCU -DARDUINO_ARCH_ESP8266 -DARDUINO_BOARD="ESP8266_NODEMCU" -DESP8266 "-IC:\Users\Pera\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.0\cores\esp8266" "-IC:\Users\Pera\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.0\variants\nodemcu" "-IC:\Users\Pera\Documents\Arduinogttp\libraries\I2Cdev" "C:\Users\Pera\AppData\Local\Temp\arduino_build_960938\sketch\OrigMPU6050.ino.cpp" -o "nul"
"C:\Users\Pera\AppData\Local\Arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\1.20.0-26-gb404fb9-2/bin/xtensa-lx106-elf-g++" -D__ets__ -DICACHE_FLASH -U__STRICT_ANSI__ "-IC:\Users\Pera\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.0/tools/sdk/include" "-IC:\Users\Pera\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.0/tools/sdk/lwip2/include" "-IC:\Users\Pera\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.0/tools/sdk/libc/xtensa-lx106-elf/include" "-IC:\Users\Pera\AppData\Local\Temp\arduino_build_960938/core" -c -w -Os -g -mlongcalls -mtext-section-literals -fno-exceptions -fno-rtti -falign-functions=4 -std=c++11 -ffunction-sections -fdata-sections -w -x c++ -E -CC -DF_CPU=80000000L -DLWIP_OPEN_SRC -DTCP_MSS=536 -DARDUINO=10805 -DARDUINO_ESP8266_NODEMCU -DARDUINO_ARCH_ESP8266 -DARDUINO_BOARD="ESP8266_NODEMCU" -DESP8266 "-IC:\Users\Pera\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.0\cores\esp8266" "-IC:\Users\Pera\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.0\variants\nodemcu" "-IC:\Users\Pera\Documents\Arduinogttp\libraries\I2Cdev" "-IC:\Users\Pera\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.0\libraries\Wire" "C:\Users\Pera\AppData\Local\Temp\arduino_build_960938\sketch\OrigMPU6050.ino.cpp" -o "nul"
"C:\Users\Pera\AppData\Local\Arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\1.20.0-26-gb404fb9-2/bin/xtensa-lx106-elf-g++" -D__ets__ -DICACHE_FLASH -U__STRICT_ANSI__ "-IC:\Users\Pera\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.0/tools/sdk/include" "-IC:\Users\Pera\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.0/tools/sdk/lwip2/include" "-IC:\Users\Pera\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.0/tools/sdk/libc/xtensa-lx106-elf/include" "-IC:\Users\Pera\AppData\Local\Temp\arduino_build_960938/core" -c -w -Os -g -mlongcalls -mtext-section-literals -fno-exceptions -fno-rtti -falign-functions=4 -std=c++11 -ffunction-sections -fdata-sections -w -x c++ -E -CC -DF_CPU=80000000L -DLWIP_OPEN_SRC -DTCP_MSS=536 -DARDUINO=10805 -DARDUINO_ESP8266_NODEMCU -DARDUINO_ARCH_ESP8266 -DARDUINO_BOARD="ESP8266_NODEMCU" -DESP8266 "-IC:\Users\Pera\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.0\cores\esp8266" "-IC:\Users\Pera\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.0\variants\nodemcu" "-IC:\Users\Pera\Documents\Arduinogttp\libraries\I2Cdev" "-IC:\Users\Pera\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.0\libraries\Wire" "-IC:\Users\Pera\Documents\Arduinogttp\libraries\MPU6050_DMP6_Multiple-master" "C:\Users\Pera\AppData\Local\Temp\arduino_build_960938\sketch\OrigMPU6050.ino.cpp" -o "nul"
"C:\Users\Pera\AppData\Local\Arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\1.20.0-26-gb404fb9-2/bin/xtensa-lx106-elf-g++" -D__ets__ -DICACHE_FLASH -U__STRICT_ANSI__ "-IC:\Users\Pera\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.0/tools/sdk/include" "-IC:\Users\Pera\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.0/tools/sdk/lwip2/include" "-IC:\Users\Pera\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.0/tools/sdk/libc/xtensa-lx106-elf/include" "-IC:\Users\Pera\AppData\Local\Temp\arduino_build_960938/core" -c -w -Os -g -mlongcalls -mtext-section-literals -fno-exceptions -fno-rtti -falign-functions=4 -std=c++11 -ffunction-sections -fdata-sections -w -x c++ -E -CC -DF_CPU=80000000L -DLWIP_OPEN_SRC -DTCP_MSS=536 -DARDUINO=10805 -DARDUINO_ESP8266_NODEMCU -DARDUINO_ARCH_ESP8266 -DARDUINO_BOARD="ESP8266_NODEMCU" -DESP8266 "-IC:\Users\Pera\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.0\cores\esp8266" "-IC:\Users\Pera\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.0\variants\nodemcu" "-IC:\Users\Pera\Documents\Arduinogttp\libraries\I2Cdev" "-IC:\Users\Pera\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.0\libraries\Wire" "-IC:\Users\Pera\Documents\Arduinogttp\libraries\MPU6050_DMP6_Multiple-master" "C:\Users\Pera\Documents\Arduinogttp\libraries\I2Cdev\I2Cdev.cpp" -o "nul"
"C:\Users\Pera\AppData\Local\Arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\1.20.0-26-gb404fb9-2/bin/xtensa-lx106-elf-g++" -D__ets__ -DICACHE_FLASH -U__STRICT_ANSI__ "-IC:\Users\Pera\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.0/tools/sdk/include" "-IC:\Users\Pera\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.0/tools/sdk/lwip2/include" "-IC:\Users\Pera\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.0/tools/sdk/libc/xtensa-lx106-elf/include" "-IC:\Users\Pera\AppData\Local\Temp\arduino_build_960938/core" -c -w -Os -g -mlongcalls -mtext-section-literals -fno-exceptions -fno-rtti -falign-functions=4 -std=c++11 -ffunction-sections -fdata-sections -w -x c++ -E -CC -DF_CPU=80000000L -DLWIP_OPEN_SRC -DTCP_MSS=536 -DARDUINO=10805 -DARDUINO_ESP8266_NODEMCU -DARDUINO_ARCH_ESP8266 -DARDUINO_BOARD="ESP8266_NODEMCU" -DESP8266 "-IC:\Users\Pera\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.0\cores\esp8266" "-IC:\Users\Pera\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.0\variants\nodemcu" "-IC:\Users\Pera\Documents\Arduinogttp\libraries\I2Cdev" "-IC:\Users\Pera\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.0\libraries\Wire" "-IC:\Users\Pera\Documents\Arduinogttp\libraries\MPU6050_DMP6_Multiple-master" "C:\Users\Pera\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.0\libraries\Wire\Wire.cpp" -o "nul"
"C:\Users\Pera\AppData\Local\Arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\1.20.0-26-gb404fb9-2/bin/xtensa-lx106-elf-g++" -D__ets__ -DICACHE_FLASH -U__STRICT_ANSI__ "-IC:\Users\Pera\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.0/tools/sdk/include" "-IC:\Users\Pera\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.0/tools/sdk/lwip2/include" "-IC:\Users\Pera\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.0/tools/sdk/libc/xtensa-lx106-elf/include" "-IC:\Users\Pera\AppData\Local\Temp\arduino_build_960938/core" -c -w -Os -g -mlongcalls -mtext-section-literals -fno-exceptions -fno-rtti -falign-functions=4 -std=c++11 -ffunction-sections -fdata-sections -w -x c++ -E -CC -DF_CPU=80000000L -DLWIP_OPEN_SRC -DTCP_MSS=536 -DARDUINO=10805 -DARDUINO_ESP8266_NODEMCU -DARDUINO_ARCH_ESP8266 -DARDUINO_BOARD="ESP8266_NODEMCU" -DESP8266 "-IC:\Users\Pera\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.0\cores\esp8266" "-IC:\Users\Pera\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.0\variants\nodemcu" "-IC:\Users\Pera\Documents\Arduinogttp\libraries\I2Cdev" "-IC:\Users\Pera\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.0\libraries\Wire" "-IC:\Users\Pera\Documents\Arduinogttp\libraries\MPU6050_DMP6_Multiple-master" "C:\Users\Pera\Documents\Arduinogttp\libraries\MPU6050_DMP6_Multiple-master\MPU6050.cpp" -o "nul"
Generating function prototypes...
"C:\Users\Pera\AppData\Local\Arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\1.20.0-26-gb404fb9-2/bin/xtensa-lx106-elf-g++" -D__ets__ -DICACHE_FLASH -U__STRICT_ANSI__ "-IC:\Users\Pera\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.0/tools/sdk/include" "-IC:\Users\Pera\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.0/tools/sdk/lwip2/include" "-IC:\Users\Pera\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.0/tools/sdk/libc/xtensa-lx106-elf/include" "-IC:\Users\Pera\AppData\Local\Temp\arduino_build_960938/core" -c -w -Os -g -mlongcalls -mtext-section-literals -fno-exceptions -fno-rtti -falign-functions=4 -std=c++11 -ffunction-sections -fdata-sections -w -x c++ -E -CC -DF_CPU=80000000L -DLWIP_OPEN_SRC -DTCP_MSS=536 -DARDUINO=10805 -DARDUINO_ESP8266_NODEMCU -DARDUINO_ARCH_ESP8266 -DARDUINO_BOARD="ESP8266_NODEMCU" -DESP8266 "-IC:\Users\Pera\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.0\cores\esp8266" "-IC:\Users\Pera\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.0\variants\nodemcu" "-IC:\Users\Pera\Documents\Arduinogttp\libraries\I2Cdev" "-IC:\Users\Pera\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.0\libraries\Wire" "-IC:\Users\Pera\Documents\Arduinogttp\libraries\MPU6050_DMP6_Multiple-master" "C:\Users\Pera\AppData\Local\Temp\arduino_build_960938\sketch\OrigMPU6050.ino.cpp" -o "C:\Users\Pera\AppData\Local\Temp\arduino_build_960938\preproc\ctags_target_for_gcc_minus_e.cpp"
"C:\Program Files (x86)\Arduino\tools-builder\ctags\5.8-arduino11/ctags" -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives "C:\Users\Pera\AppData\Local\Temp\arduino_build_960938\preproc\ctags_target_for_gcc_minus_e.cpp"
Compiling sketch...
"C:\Users\Pera\AppData\Local\Arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\1.20.0-26-gb404fb9-2/bin/xtensa-lx106-elf-g++" -D__ets__ -DICACHE_FLASH -U__STRICT_ANSI__ "-IC:\Users\Pera\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.0/tools/sdk/include" "-IC:\Users\Pera\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.0/tools/sdk/lwip2/include" "-IC:\Users\Pera\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.0/tools/sdk/libc/xtensa-lx106-elf/include" "-IC:\Users\Pera\AppData\Local\Temp\arduino_build_960938/core" -c -w -Os -g -mlongcalls -mtext-section-literals -fno-exceptions -fno-rtti -falign-functions=4 -std=c++11 -MMD -ffunction-sections -fdata-sections -DF_CPU=80000000L -DLWIP_OPEN_SRC -DTCP_MSS=536 -DARDUINO=10805 -DARDUINO_ESP8266_NODEMCU -DARDUINO_ARCH_ESP8266 -DARDUINO_BOARD="ESP8266_NODEMCU" -DESP8266 "-IC:\Users\Pera\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.0\cores\esp8266" "-IC:\Users\Pera\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.0\variants\nodemcu" "-IC:\Users\Pera\Documents\Arduinogttp\libraries\I2Cdev" "-IC:\Users\Pera\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.0\libraries\Wire" "-IC:\Users\Pera\Documents\Arduinogttp\libraries\MPU6050_DMP6_Multiple-master" "C:\Users\Pera\AppData\Local\Temp\arduino_build_960938\sketch\OrigMPU6050.ino.cpp" -o "C:\Users\Pera\AppData\Local\Temp\arduino_build_960938\sketch\OrigMPU6050.ino.cpp.o"
In file included from C:\Users\Pera\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.0\cores\esp8266/Arduino.h:244:0,

             from C:\Users\Pera\AppData\Local\Temp\arduino_build_960938\sketch\OrigMPU6050.ino.cpp:1:

C:\Users\Pera\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.0\cores\esp8266/pgmspace.h:16:51: error: __c causes a section type conflict with __c

#define PSTR(s) (extension({static const char __c[] PROGMEM = (s); &__c[0];}))

                                               ^

C:\Users\Pera\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.0\cores\esp8266/WString.h:38:76: note: in definition of macro 'FPSTR'

#define FPSTR(pstr_pointer) (reinterpret_cast<const __FlashStringHelper *>(pstr_pointer))

                                                                        ^

C:\Users\Pera\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.0\cores\esp8266/WString.h:39:34: note: in expansion of macro 'PSTR'

#define F(string_literal) (FPSTR(PSTR(string_literal)))

                              ^

C:\Program Files (x86)\Arduino\examples\14.Experiment\OrigMPU6050\OrigMPU6050.ino:225:20: note: in expansion of macro 'F'

 Serial.println(F("FIFO overflow!"));

                ^

C:\Users\Pera\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.0\cores\esp8266/pgmspace.h:16:51: note: '__c' was declared here

#define PSTR(s) (extension({static const char __c[] PROGMEM = (s); &__c[0];}))

                                               ^

C:\Users\Pera\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.0\cores\esp8266/WString.h:38:76: note: in definition of macro 'FPSTR'

#define FPSTR(pstr_pointer) (reinterpret_cast<const __FlashStringHelper *>(pstr_pointer))

                                                                        ^

C:\Users\Pera\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.0\cores\esp8266/WString.h:39:34: note: in expansion of macro 'PSTR'

#define F(string_literal) (FPSTR(PSTR(string_literal)))

                              ^

C:\Users\Pera\Documents\Arduinogttp\libraries\MPU6050_DMP6_Multiple-master/DeathTimer.h:45:22: note: in expansion of macro 'F'

     Serial.print(F("S:")); Serial.println(time % 60);

                  ^

Using library I2Cdev in folder: C:\Users\Pera\Documents\Arduinogttp\libraries\I2Cdev (legacy)
Using library Wire at version 1.0 in folder: C:\Users\Pera\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.0\libraries\Wire
Using library MPU6050_DMP6_Multiple-master in folder: C:\Users\Pera\Documents\Arduinogttp\libraries\MPU6050_DMP6_Multiple-master (legacy)
exit status 1
Error compiling for board NodeMCU 1.0 (ESP-12E Module).

I am not so good in programming to understand what I can do to solve the problem !
I'd like to use NodeMCU with two MPU6050 and I need help !

you have not asked a question. ...... what research have you done?

While we wait for a 2nd approval on the edit a kind person did for you on your question, may I ask if you have successfully compiled a simple program for the NodeMCU.  As the Arduino Uno and the NodeMCU used completely different processors, you need to take care that both are setup correctly in your IDE.

jsotola , the question is: can You help me understanding this compiler message : :   "Arduino15\packages\esp8266\hardware\esp8266\2.4.0\cores\esp8266/pgmspace.h:16:51: error: __c causes a section type conflict with __c " ?

st2000, about NodeMCU  setup You can see from the first line of compiler message "Arduino: 1.8.5 (Windows 7), Board: "NodeMCU 1.0 (ESP-12E Module), 80 MHz, 4M (3M SPIFFS), v2 Prebuilt (MSS=536)"

It is an issue in esp8266 Arduino core. It is hard to explain, but here is a workaround for you:
In MPU6050_Wrapper.h change word __FlashStringHelper to char for function halt to be void halt(const char* errMessage = NULL).
In DeathTimer.h remove #include <Arduino.h>.
In sketch add before includes #define F(s) s to hide the F macro.

Juraj, MY HAT OFF !!! Thanks for your guidance.It works now like a charm ! I think there is no many people with knowledge like yours !


text:
How to add two assembly arrays in arduino
Hey guys what I'm trying to do is to sum two arrays and return a new array; for example if given
  uint8_t a[] = {2, 4, 6};
  uint8_t b[] = {1, 2, 3};

I should get { 3, 6, 9} What I'm trying to do is have a .ino file call on an assembly file that will do this in assembly and not in C and this is what I currently have in assembly:
// mimics void sumArrays(uint8_t *a, uint8_t *b, uint8_t *c, byte length){} method
    .global sumArrays
    sumArrays:
      //r18 is the byte length
      //r24 and r25 first  array 31,30
      //r23 and r22 second array 29,28
      //r21 and r20 third  array 27,26

      mov r30, r24
      mov r31, r25
      mov r28, r22
      mov r29, r23
      mov r26, r20
      mov r27, r21
      ldi r17, 0 //counter variable
      ldi r19, 1
      call printRegs
      //jmp sumLoop

      ret

    sumLoop:
      cp r17, r18
      brge endSumLoop
      ldi r16, 0
      add r16, Z+
      add r16, Y+
      st X+, r16
      add r17, r23
      jmp sumLoop:

    endSumLoop:
      ret

However, I get sketch/assignment13.S:65: Error: constant value required which is most likely from the
add r16, Z+
add r16, Y+

Lines but otherwise, how would I add it to a temporary variable while progressing the pointer?

Why are you using assembly for this instead of C?

add r16, Z+

You probably meant something like
add r16, memory[Z+]

However, the AVR is a RISC processor. It has instructions to address the
memory, and instructions to do arithmetics, but it has no “complex”
instructions that both address the memory and do arithmetics with the
addressed data. So you have to use separate instructions to:

Load (ld) the data from RAM

do the arithmetics

store (st) the result in RAM

Now, looking at your assemble code, I have a few comments:

If you are mixing assembly and C/C++, you should pay attention to the
ABI conventions. Specifically, some registers, like r28 and
r29, “belong” to the caller. If your function needs to use them, it
should save their contents (typically by pushing them to the
stack) before clobbering them, and restore them (pop) before
returning.

For adding two 8-bit numbers (a + b), a single addition is enough.
There is no point in starting the addition with zero (i.e. computing
0 + a + b).

For managing the counter, it can be more convenient to decrement the
initial count you where given (like in C: if (--length) return;)
rather than using an extra variable that is incremented.

There is no need to split such a simple function into smaller
functions.

source: Stack Exchange

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

sort: votes


text:
ESP01 + Arduino UNO
I spent on this question more than 2 weeks of googling with no success.
I do not get a response from ESP8266 version 01 on AT commands.
I need to access Wi-Fi from Arduino via ESP8266-01. I know that ESP8266 can be programmed to work without Arduino and so on, but I need it to be a Wi-Fi module for Arduino. On most of the websites Arduino is used as UART for direct programming of ESP8266-01, but I am making this setup to make it work as a Wi-Fi support for Arduino:
  esp       Arduino
  ---       -------
   RX <---> pin 6 (TX) via voltage divider (5V-3.3V)
   TX <---> pin 5 (RX) (3.3V)
  Vcc <---> 3.3v
  GND <---> GND
CH_PD <---> 3.3V via 10k resistor
GPIO0 <---> 3.3V via 10k resistor
GPIO2 <---> 3.3V via 10k resistor

Then I upload this code on Arduino:

SoftwareSerial espSerial(5, 6);

const int COM_BAUD = 9600;

void setup() {
  espSerial.begin(COM_BAUD);
  Serial.begin(COM_BAUD);
  Serial.println("Setup done");
}

void loop() {
  if ( espSerial.available() )
    Serial.write( espSerial.read() );
  if ( Serial.available() )
    espSerial.write( Serial.read() );
}

It prints on AT monitor:
Setup done
But when I send AT command it is not even printed on AT monitor.
One more point -> New wifi called "AITHINKER..." is being created and I even connect to it, of course, this does not grant me access to the web. But this is a good sign telling that ESP8266-01 is working, both current and voltage are enough for operation.
So it does not respond or receives AT commands.
There is no documentation for correct connection of esp01 as wifi of Arduino Uno and I will be very happy if you could share some websites using ESP8266-01 as Wi-Fi of Arduino Uno correctly.
There are some points which are usually resolved other problems of such kind, but did not resolve mine:
- External power supply with common to Arduino ground -> done
- Change RX, TX pins -> done
- Replace ESP8266-01 -> having 5 of them, protecting from over voltage
Please, help me... Losing any hope on this...
P.S. It responds to AT commands when I connect it directly to the computer via USB UART cable.
The problem comes when I connect it to Arduino as the module...

How have you constructed your voltage divider?

30k is far too high. 220/430 may be too low. The best I have found is 1x1k + 2x1k (1k+2k).

@Majenko
I constructed voltage divider in 2 ways. First a 30k potentiometer with in of 5v and out of 3.3 v and typical voltage divider with R1= 220 and R2 = 430 ohms. In both ways I checked in and out voltage via multimeter

The AT command firmware for the ESP8266 modules have not always been set to 9600 bps. You might try 115200 and 57600 bps settings and see if that shows the result.
Also, connect the ESP8266 module directly to an FTDI or similar UART-USB bridge, temporarily eliminating the Arduino, so you can do more experimentation with the baud rates, etc. Then you would be able to easily see if the startup output from the ESP8266 looks garbled (which might indicate a serial speed mismatch), or if there is no output at all.
Another possibility is that the AIThinker module doesn't have the AT command firmware on it. From what source did you obtain the module -- what documentation is provided by that vendor?

Thank you for answering! Yes, I changed baud rates. Also forgot to tell that sometimes it prints me reset cause error #4. I am sure that it should response to AT commands since it does respond when I connect it via UART directly

@MadinaBektayeva: And those commands and responses were sent/receieved at 9600 baud, as in your sketch?

I see in your code example that you are echoing the regular serial port to the SoftwareSerial (ESP) port. Part of debugging would be to eliminate various things from your code to isolate the problem area. So, try eliminating that loop and just hard-code the AT command to send to the ESP8266.

@JRobert I changed them both in sketch and in serial monitor. Tried all of them and most of possible combinations which are >1200 &<115200

I have previously written an Instructables article about how to set up an ESP8266 ESP-01 Wi-Fi module available here: Definitive Guide to Setting Up Your New ESP01 Module, which includes more or less everything you need to know to set up and interface your ESP8266 chip with either your computer or your Arduino Uno (on step 4, which mentions that you should reduce the baud rate).
The main problems you might be facing right now are:

The Arduino Software Serial ports only support speeds up to 57600 baud if I'm not wrong, but the ESP-01 module typically comes out of the box with 115200 baud.
The Arduino 3.3V regulator may not have enough current to supply the ESP8266. It's a very power hungry chip relative to an Arduino. If you don't mind, do post a picture of your Arduino Uno (or compatible) so I know if it's a power supply issue.
The Arduino 3.3V pin does not provide adequate power supply decoupling, which may cause the ESP8266 to malfunction with cheap power supplies.

I designed a PCB called the ESPBlaster which you may be interested in. It takes a USB-TTL module on one side and has a socket for an ESP8266 module on the other to facilitate direct communications from your computer to the ESP8266 so you can set it to the correct baud rate so that you can interface it with an Arduino Uno, and contains a specially designed voltage regulator which does provides adequate current and decoupling.

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


text:
flash read err, 1000
I know this question has been asked multiple times but solutions giving there hasn't been working,
I've got an esp32 soldered to my own designed PCB board with a UART to USB converter all that is working fine, I can get connected to my esp from the Serial monitor.
But it prints every about 0.5s:
rst:0x10 (RTCWDT_RTC_RESET)
boot:0x13 (SPI_FAST_FLASH_BOOT)
flash read err, 1000 ets_main.c
371 ets Jun 8 2016 00:22:57

Solutions have been to make sure to have 3.3v on the esp. I find it unlikely to have anything to do with it, 'cause its voltage range goes from 2.6v to 3.6v, but anyway I have tested it with an advanced transformer and a multimeter to check that there was 3.3v on the Vcc pin (didn't change anything).
All help would be appreciated.
Here is a bit more info:
I've also connected a 10uF capacitor (someone told me to try that).
If I pull IO0 to ground, it prints waiting for download in the serial monitor and I can almost upload the program, this is what I get:

THERE IS NO CONNECTION BETWEEN NEIGHBORING PINS

(I have checked with multimeter)
PCB board:

Please provide images of your custom PCB

I had this kind of error sometimes and it always seemed to be related to a broken flash in the esp32. Do you have anything connected to the SPI pins?

@SimSon could you explain what the SPI pins is? (sorry for my lack of knowledge)

The esp chip itself doesn't have an internal flash to store the program but uses an external flash instead. Communication with this flash happens via serial peripheral interface (SPI) which also is available on the esp's pins. Obviously you haven't connected anything except the serial lines.

How did you assemble the esp on that pcb? Reflow? Solder iron? I just wonder why the surface looks a bit demolished...

solder iron and flux, the "demolished" is left overs from the flux

@SimSon the tutorial on hooking up your esp with usb, does not need or contain any "SPI", but do i have to connect the SPI i pins to something? and does they only need to be connected during upload?

@MariusWanscher there's no need for anything like that, the esp is connected to the flash internally and its firmware/bootload manages everything

@MariusWanscher ok, I just couldn't see wether it was flux or the pcb might have become too hot during reflow. From my experience the flash is the least temperature-tolerant part inside the esp. Was flashing actually ever possible on this individual?

@MariusWanscher no, not the spi pins!

How do you actually flash it without having the flash- and reset-pins connected to your pcb? Also your pcb is missing pull-up resistors. Have you taken a look at a minimal circuit? https://www.14core.com/wiring-and-flashing-programming-esp-32-esp32s-with-usb-ttl-uart/?cn-reloaded=1

No, I haven't gotten it to fully flash, ArduinoIDE says that it has uploaded the whole program but afterwards, the serial monitor goes quiet, if I restart the chip(by pulling EN to ground) it just starts spitting out the ram 1000 err

I simply take a jumper cable and connect it with ground and touch either io0 or EN

ok, the solution was to add a 10k pull-up resistor to the EN pin, as shown HERE
No capacitor needed

Your PCB is lacking in the majority of things you need to get the module working. These modules are not "simple" in that you provide power and forget about it. You must add all the required support components. Those support components are NOT optional. For example: you aren't setting the boot mode properly with the right pullups. You lack a capacitor on the power pins (I told you to add one already. Where is it?). Also your power traces are too thin. The impedance is too high.

there is a 10uF capacitor added, its the second black and red wire you see on the image, I have moved it directly on the power pins, still not working

and what do you mean by "I'm not setting the boot mode properly", serial monitor literally says it's in boot mode

There's many ways of booting the ESP32. You haven't selected one. Read section 2.4 "Strapping Pins" in the ESP32 datasheet.

And you can't have a decoupling capacitor on the end of a pair of wires. It makes it pointless. Solder it directly on to the power pins of the module. https://photos.app.goo.gl/rjTESshnQGQjjtmdA

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


text:
How can I pause a stepper motor with a ultrasonic sensor?
I'm trying to use a stepper motor to stay stationary and rotate about 90 degrees, when the ultrasonic sensor detects something in front of it, and stay at that position until the ultrasonic sensor does not detect anything in front of it any more, to which the motor will rotate back to it's original position.
I'm using an Arduino Uno, a Longruner 5X Geared Stepper Motor 28byj 48 Uln2003 5v Stepper Motor with a  Uln2003 Driver Board.

#include <Stepper.h>

const int stepsPerRevolution = 200;

Stepper myStepper(stepsPerRevolution, 8, 9, 10, 11);

// defines pins numbers
const int trigPin = 7;
const int echoPin = 6;

// defines variables
long duration;
int distance;

void setup() {

   pinMode(trigPin, OUTPUT); // Sets the trigPin as an Output
   pinMode(echoPin, INPUT); // Sets the echoPin as an Input
   Serial.begin(9600); // Starts the serial communication
   myStepper.setSpeed(60);
    // initialize the serial port:  (again??)
   Serial.begin(9600);
}

void loop() {
   digitalWrite(trigPin, LOW);
   delayMicroseconds(2);

// Sets the trigPin on HIGH state for 10 micro seconds
   digitalWrite(trigPin, HIGH);
   delayMicroseconds(10);
   digitalWrite(trigPin, LOW);

// Reads the echoPin, returns the sound wave travel time in microseconds
   duration = pulseIn(echoPin, HIGH);

// Calculating the distance
   distance= duration*0.034/2;

// Prints the distance on the Serial Monitor
   Serial.print("Distance: ");
   Serial.println(distance);

   if (distance < 10) {
       myStepper.step(-stepsPerRevolution);
       delay(1000);
       if (distance > 10) {
           myStepper.step(stepsPerRevolution);
           delay(10000);
       }
   }
}

Here's my code. I can't really figure out how to stop/pause the stepper motor once it rotates. Any ideas? (I'm a beginner, so apologies for any beginner mistakes).

it is your job to tell us what you see happening when you run the program ... please edit your post above ... do not use comments

the stepper motor control and the ultrasonic sensor reading are two completely separate functions .... develop the stepper motor code separately from the sensor ...  use a pushbutton to initiate the motor motion ... when the motor behaves the way you want it to behave, then add the sensor code

I do not think it is a major issue, but why are you calling Serial.begin() twice?

Oops my mistake didn't catch that


text:
Why does the RCSwitch.available return false?
I am trying to use this example code from the RCSwitch library:
/*
  Simple example for receiving

  https://github.com/sui77/rc-switch
*/

#include <RCSwitch.h>

RCSwitch mySwitch = RCSwitch();

void setup() {
  Serial.begin(9600);
  mySwitch.enableReceive(0);  // Receiver on inerrupt 0 => that is pin #2
}

void loop() {
  if (mySwitch.available()) {
    Serial.print("Is avail");
    int value = mySwitch.getReceivedValue();

    if (value == 0) {
      Serial.print("Unknown encoding");
    } else {
      Serial.print("Received ");
      Serial.print( mySwitch.getReceivedValue() );
      Serial.print(" / ");
      Serial.print( mySwitch.getReceivedBitlength() );
      Serial.print("bit ");
      Serial.print("Protocol: ");
      Serial.println( mySwitch.getReceivedProtocol() );
    }

    mySwitch.resetAvailable();
  }
}

It seems like the mySwitch.available() is returning false, but since there seems to be no documentation for the library I don't know what it means.
So why is that?
I am trying to use this code on a A-Star 32U4 Micro, which supports Arduino code.

I think that the value of available just determine if there is a message to receive or not.

Yes, looking at the source code of the library, it seems that available() returns false if no data has been received yet.

Your code is OK. It seems that the transmitter's remote control frequency is different from the receiver. Both transmitters and receivers must have the same frequency.
433MHZ - TX with 433MHZ - RX
315MHZ - TX with 315MHZ - RX

HI,I checked,The wall switch is labeled with "433.92Mhz", reciever is https://www.ebay.co.uk/itm/Wireless-Arduino-Board-433-Mhz-ARM-MCU-WL-RF-Transmitter-Receiver-Module/383290224258?_trkparms=aid%3D111001%26algo%3DREC.SEED%26ao%3D1%26asc%3D225076%26meid%3De6c2980a03e448be9d95fa63b1712d9d%26pid%3D100675%26rk%3D1%26rkt%3D15%26mehot%3Dnone%26sd%3D383290224258%26itm%3D383290224258%26pmt%3D1%26noa%3D1%26pg%3D2380057&_trksid=p2380057.c100675.m4236&_trkparms=pageci%3A9e380796-6c8a-11ea-95a5-74dbd180ac79%7Cparentrq%3A04508ddc1710ad30d3145344ffc97aa4%7Ciid%3A1. It make me crazy :-(  I have to miss smt

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


text:
LED too dim when connected to digital output pin
I am making an attempt to put LED headlights in an RC car I am building. I want the headlights to turn on when I click circle on a PlayStation 4 Dual Shock controller.  I currently have it working except the LED is very dim and not near as bright as if I just power it from the 5v pin on the arduino board.  Since I want it to only turn on when circle is pressed I have it connected to digital pin 7.  Here is my code.  Any help would be much appreciated!
/*
 Example sketch for the PS4 Bluetooth library - developed by Kristian Lauszus
 For more information visit my blog: http://blog.tkjelectronics.dk/ or
 send me an e-mail:  kristianl@tkjelectronics.com
 */

#include <PS4BT.h>
#include <usbhub.h>
#include <Servo.h>

// Satisfy the IDE, which needs to see the include statment in the ino too.
#ifdef dobogusinclude
#include <spi4teensy3.h>
#include <SPI.h>
#endif

USB Usb;
//USBHub Hub1(&Usb); // Some dongles have a hub inside
BTD Btd(&Usb); // You have to create the Bluetooth Dongle instance like so
Servo servo1;
Servo servo2;

/* You can create the instance of the PS4BT class in two ways */
// This will start an inquiry and then pair with the PS4 controller - you only have to do this once
// You will need to hold down the PS and Share button at the same time, the PS4 controller will then start to blink rapidly indicating that it is in paring mode
PS4BT PS4(&Btd, PAIR);

// After that you can simply create the instance like so and then press the PS button on the device
//PS4BT PS4(&Btd);

const int headlights = 7;
bool printAngle, printTouch;
uint8_t oldL2Value, oldR2Value;

void setup()
{
  Serial.begin(115200);
#if !defined(__MIPSEL__)
  while (!Serial); // Wait for serial port to connect - used on Leonardo, Teensy and other boards with built-in USB CDC serial connection
#endif
  if (Usb.Init() == -1)
  {
    Serial.print(F("\r\nOSC did not start"));
    while (1); // Halt
  }
  Serial.print(F("\r\nPS4 Bluetooth Library Started"));

  pinMode (3, OUTPUT);
  pinMode (5, OUTPUT);
  servo1.attach (3);
  servo2.attach (5);
}
void loop()
{
  Usb.Task();

  if (PS4.connected())
  {
    servo1.write(map(PS4.getAnalogHat(RightHatX), 0, 255, 50, 0));
    servo2.write(map(PS4.getAnalogButton(R2), 0, 255, 90, 0));
  }
  else
  {
    servo1.write (25);
    servo2.write (90);
  }

  if (PS4.getAnalogHat(LeftHatX) > 137 || PS4.getAnalogHat(LeftHatX) < 117 || PS4.getAnalogHat(LeftHatY) > 137 || PS4.getAnalogHat(LeftHatY) < 117 || PS4.getAnalogHat(RightHatX) > 137 || PS4.getAnalogHat(RightHatX) < 117 || PS4.getAnalogHat(RightHatY) > 137 || PS4.getAnalogHat(RightHatY) < 117)
  {
      Serial.print(F("\r\nLeftHatX: "));
      Serial.print(PS4.getAnalogHat(LeftHatX));
      Serial.print(F("\tLeftHatY: "));
      Serial.print(PS4.getAnalogHat(LeftHatY));
      Serial.print(F("\tRightHatX: "));
      Serial.print(PS4.getAnalogHat(RightHatX));
      Serial.print(F("\tRightHatY: "));
      Serial.print(PS4.getAnalogHat(RightHatY));
  }

    if (PS4.getButtonClick(PS)) {
      Serial.print(F("\r\nPS"));
      PS4.disconnect();
    }

    else {
        if (PS4.getButtonClick(CIRCLE)) {
        Serial.print(F("\r\nCircle"));
        digitalWrite(headlights, HIGH);
        }

      if (PS4.getButtonClick(CROSS)) {
        Serial.print(F("\r\nCross"));
        digitalWrite(headlights, LOW);
      }

      if (PS4.getButtonClick(TRIANGLE)) {
        Serial.print(F("\r\nTraingle"));
        PS4.setRumbleOn(RumbleLow);
      }

      if (PS4.getButtonClick(SQUARE)) {
        Serial.print(F("\r\nSquare"));
        PS4.setLedFlash(0, 0); // Turn off blinking
      }

      if (PS4.getButtonClick(UP)) {
        Serial.print(F("\r\nUp"));
        PS4.setLed(Red);
      } if (PS4.getButtonClick(RIGHT)) {
        Serial.print(F("\r\nRight"));
        PS4.setLed(Blue);
      } if (PS4.getButtonClick(DOWN)) {
        Serial.print(F("\r\nDown"));
        PS4.setLed(Yellow);
      } if (PS4.getButtonClick(LEFT)) {
        Serial.print(F("\r\nLeft"));
        PS4.setLed(Green);
      }

      if (PS4.getButtonClick(L1))
        Serial.print(F("\r\nL1"));
      if (PS4.getButtonClick(L3))
        Serial.print(F("\r\nL3"));
      if (PS4.getButtonClick(R1))
        Serial.print(F("\r\nR1"));
      if (PS4.getButtonClick(R3))
        Serial.print(F("\r\nR3"));

      if (PS4.getButtonClick(SHARE))
        Serial.print(F("\r\nShare"));
      if (PS4.getButtonClick(OPTIONS)) {
        Serial.print(F("\r\nOptions"));
        printAngle = !printAngle;
      }
      if (PS4.getButtonClick(TOUCHPAD)) {
        Serial.print(F("\r\nTouchpad"));
        printTouch = !printTouch;
      }
     }
    }

You forgot to set headlights as an output, meaning that you're attempting to power the LED through the 20k-50kohm input pullup.


text:
Doesn't work radio transmission from Arduino Uno to Arduino Pro Micro
I have Arduino Uno, Arduino Pro Micro, XY-MK-5V and FS1000A.
I need transmit data from Pro Micro to Uno.
Transmitter:
    #include <VirtualWire.h>

    void setup() {

      Serial.begin(9600);

      vw_setup(2000);
      vw_set_tx_pin(14);
    }

    void loop() {

      send("Test message!");
      delay(2000);
    }

    void send (char *message)
    {
      vw_send((uint8_t *)message, strlen(message));
      vw_wait_tx();
    }

Receiver:
#include <VirtualWire.h>

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

    vw_set_rx_pin(12);
    vw_setup(2000);

    vw_rx_start();
}

void loop()
{
    uint8_t buf[VW_MAX_MESSAGE_LEN];
    uint8_t buflen = VW_MAX_MESSAGE_LEN;

    if(vw_get_message(buf, &buflen))
    {
        for(int i = 0; i < buflen; i++)
        {
            Serial.print(buf[i]);
        }

        Serial.println();
    }
}

I dont know why it's doesn't works. When I changed Uno with Micro and Micro with Uno, it's worked.
But I need: Micro + transmitter FS1000A & Uno + receiver XY-MK-5V.
Please help me. I'm using this Pro Micro.

What in particular doesn't work? You don't receive any characters? You get a garbage message?

And which Pro Micro: the geniune SparkFun Pro Micro - which version (it says on the PCB); the A-Star variant; a cheap chinese copy?

Are you connecting the modules to the right pins? vw_set_tx_pin(14); looks a bit odd, if you used that on the UNO.

On a Pro Mirco, D14 is connected to the RX LED, and nothing else; it's not broken out to either of the headers so you would never be able to use it to connect to an external component.

Thanks for your answers. I solved this problem, my Chinese copy has problems with power.

Please use the edit link on your question to add additional information. The Post Answer button should be used only for complete answers to the question.

@NickGammon The problem was solved according to feok. This is an answer although it has not been accepted.


text:
HC-06 module versus 1sheeld
Why would someone buy a 1sheeld?
Why not connect an Arduino to their smartphone using HC-06 bluetooth module and find an appropriate Android app, like for example RoboRemo. What is the advantage of using a 1sheeld?

What is "1sheeld" when it's at home?

Why would you buy a car when you can cobble something together from some old pram wheels, a lawnmower engine, some old scaffolding, gaffer tape and chewing gum?
Because buying a car is considerably easier and more reliable.  Plus your "friends" don't laugh at you when they see you trying to drive it to work.
Yes, you could cobble something together that might work using random components and other bits of software, but the work involved would be considerably more than plugging in a shield and downloading an app that is guaranteed to work perfectly with that shield.

Giving an equally biased answer as @Majenko, from the other side:
Because they're lazy, they don't know anything about electronics, and they don't want to. And they have more money than they know what to do with.
I am horrified at people shelling out for an "Arduino Temperature Sensor", "Arduino Shift Register", or "Arduino LED", each of which is a generic component soldered on to a board, with pins, at a 1000% markup
I also question the claim that "cobbled together" items are more reliable, or are less likely to have people laugh at you - if you want it to look nice, put it in a nice box (this applies both to "pre-made" items, and to cobbled together).
You will also learn a lot more from making it yourself; you will learn how things work, and you have a better idea and have the opportunity to fix when things go wrong. Your projects will also be a lot smaller.
If you want something that "just works", go buy an ipad. Then, when it doesn't work, throw it in the rubbish and buy a new one. And if you want it to do something it doesn't do, tough luck.

1000% ? The cost of spinning a board, pcba, and all the headaches that manufacturing brings far exceeds the cost of any single component. I would be surprised if people make much money even on  the simple shields. The value in a product like this is 1. Existing API so you don't have to start designing a framework from day 1 just to test an idea 2. Validated Design so you know the components all work together (multiple options for everything under the sun). Even professionals will purchase dev-boards for a huge markup to have some grounding with a device before moving to custom designs.

1,000% markup means the sell price is 11 times the cost price. For example: http://www.jaycar.co.nz/p/XC4230 (NZ$22) is http://www.aliexpress.com/item/New-DS18B20-Temperature-Measurement-Sensor-Module-High-Quality/1887290646.html (US$1.29) with Arduino branding.


text:
Connect arduino nano and ESP32 with I2C on the GPIO7 and GPIO8?
I made a mistake connecting SD0 (GPIO7) and SD1 (GPIO8) with the SDA and SCL on my arduino nano. I got confused with GPIO21 and pin21 and GPIO22 and pin 22!
Since I made a PCB prototype, I would avoid to add some wires and cut the traces, so I would ask if I could use these pins (GPIO7 and GPIO8) as SDA and SCL.
If the answer is affirmative, using Arduino library how could I assign them?
Wire.begin (7,8)?
Another question, I would use a dedicate 2x4.7K pull up resistors. On the arduino side I wrote:
digitalWrite(SDA, 0);
digitalWrite(SCL, 0);
It is correct to do the same thing on the ESP32 side?
Update November 01:
After the question from Majenco I think I need more help for the I2c setup.
I designed the PCB having in mind that the esp32 was 5V tolerant, so at the moment I pull-up the SDA, SCL from the 5V that I input in the esp power pin. Note that this 5V doesn't come from the Nano due to the high current required by the esp. I take my 12V power supply input and regulate it to 5V with a 7805, only dedicated to the esp (I know, a lot of dissipation! In the next PCB version I have to change the things, having in mind that I need both 12V and 5V in my circuit).
Now, I read that the esp32 is not 5V tolerant. In order to avoid level shifter can I pull up the SDA and SCL from the 3.3V line (the arduino 3.3V or esp32 one?)?
I would use the esp32 as master.
Thanks.

As I know, the Wire library is a hardware I2C library, not software. Hardware I2C is bound to special pins. And why would you try to pull both lines to low via digitalWrite?

I would pull low the two lines in order to eliminate the internal arduino pull up resistors from the circuit, using the esternal one. I don't know if I can do same  on the esp32 side.

If you are using hardware I2C on the Nano, the lines would do nothing, since the pins are controlled by the I2C hardware instead of the digital output hardware. If you are using software I2C, The pins will be controlled by the library. Doing the digitalWrite will disable the internal pullups for the moment, but as soon as the library takes action, the pins will be set to the libraries default state (most likely with enabled pullup, but not garanteed). So I think these lines do not serve a function on the Arduino.

Since I made a PCB prototype, I would avoid to add some wires and cut the traces, so I would ask if I could use these pins (GPIO7 and GPIO8) as SDA and SCL.

No, you can't. Those pins are used by the internal flash chip. If you connect things to them you will end up not being able to read the flash and thus won't be able to run any code.  In other words, the chip will not boot. So you will have to bite the bullet and cut traces and add bodge wires.

Wire.begin (7,8)?

Yes. That will control the bus matrix to route the I2C through different pins - but of course you can't use those pins, as noted above.

On the arduino side I wrote:
digitalWrite(SDA, 0); digitalWrite(SCL, 0);
It is correct to do the same thing on the ESP32 side?

No. That exploits a quirk in the AVR GPIO system that doesn't exist in the ESP32. In the ESP32 the pins are configured with:
pinMode(sda, OPEN_DRAIN | PULLUP | INPUT | OUTPUT );

and
pinMode(scl, INPUT | PULLUP);

so you could try replicating that in your code but without the PULLUP flag. However the effect of this is unknown, so YMMV.
However, if your external pullups are pulling up to 3.3V then you really don't need to do anything on the ESP32. All you end up with is a large resistance in parallel with your 4.7kΩ, which will just cause your resistance to drop slightly (and since 4.7kΩ is arguably too high any way that's a good thing).

it is 7 and 8 on Nano

@Juraj No, it's SD0 and SD1, which are GPIO7 and 8 on the esp32! Read the question. The nano is irrelevant.

yes, sorry, you are right.

@Majenco so how could I use the external 4.7K pull up without interfere with the esp32 internals?

@daigs What voltage are you pulling up to?

@Majenaco good question :-) I'm in trouble! I try to edit the first post to have a little more help from you over the question.


text:
Laser Controller using Arduino Uno
---> I am trying to create a controller using Arduino Uno that simply detects pulses from a waveform generator mimicking a Laser Machine and then switches between 4 state machines states at the output of a Pre-amp, it is a built on of this previous post so the connections are the same except for the waveform generator settings. The new waveform generator settings are :
Type: Pulse, Freq:20Hz (50ms), Amp:5.0 Vpp, Offset:0V, Width = 100ns
---> I am trying to add 5 things in the project so any input is greatly appreciated:
1) Initialize all the 4 state machine states into an Array so user can define as many states as they want from the declarations.
2) ADD a digital de-bounce to the input pin, LASER_PIN.
3)(requires item #5 to be done first)  ADD a reset to the system which moves the program back to STATE_00  from whatever it is doing.
4) Better code to wait until a pulse from Laser arrives before going to the state machine in void loop().
5) (item #2 depends on this) Completely Remove delay from the CountPulses() function and replace with millis() function to allow the use of reset button
---> Here is what i have so far, i started off by adding 4 state machine states and using the delay() function in the CountPulses() function just like in the previous post and it works fine and i am able to switch states while counting pulses, however, when i added the millis() to replace delay() function as shown below in the code, i only get 0s in pulse count and the state machine is stuck in STATE_00 so i used a couple of print statements to debug  and it turns out currentmillis() - startmillis() is actually less than period = 1000ms so i am stuck on how to set this up and without this i cannot move forward, any help would be appreciated. My code and serial monitor results are shown below:
--> UPDATE: items #3 and #5 work perfectly fine , please see updated code. for item #4 i have not figured this one out yet. for item #2 ,there are a lot of libraries for debounce but not sure which libraries (Button, Bounce and etc) are most trusted by arduino community, any suggestions would help.
-->UPDATE 2: The code has been update with the following changes, external interrupts are used to reset the system if switch is LOW, Polling with interrupts is used to wait for pulses.
THE UPDATE TO QUESTION: items#3, 4 and 5 were solved and now only 2 items remain to be added to the project with modifications to item #1 and item #2 based on comments:
1) I require the state machine to do the following:
a) Declared in an array where user can easily change the order of execution of states. (eg: state_2--> state_1 -->state_3--> state_0).
b) User can easily decrease the number of states from MAX_VALUE = 4 to only 1 state. (eg with MAX_VALUE = 3: state_0--> state_1--> state_2)  .
2) ADD a digital de-bounce to the input pin, RESET_PIN.
Note: The debounce to LASER_PIN was a mistake in understanding based on the comments, so i have updated this.
Updated code with current serial monitor results is shown below:
       //Objectives: Use input from laser to control pre-amp on adc. Multiplex the inputs on Pre-Amp
//Date:10/21/2019
//Type: Pulse, Freq:20Hz (50ms), Amp:5.0 Vpp, Offset:500mV, Width = 100ns

//-----------------------PROJECT LIBRARIES----------------------------------
#include <Bounce2.h>
#include <Arduino.h>
#include <avr/io.h>
#include <avr/wdt.h>
#include <avr/interrupt.h>
//-----------------------DEFINES------------------------------------------
//Declare Laser Input Pin
#define LASER_PIN 2

//Declare Reset Pin
#define RESET_PIN 3

//Define the states of the machine
typedef enum {STATE_00, STATE_01, STATE_10, STATE_11} fsm_state_type;
fsm_state_type fsm_state = STATE_00;

// -------------------------CONSTANTS (won't change)-------------------------------------
const unsigned long period = 1000;  //the value is a number of milliseconds

//-------------------------VARIABLES (will change)-------------------------------------
bool only_for_print = false;//used only for print state ments

int reset_switch = 1;//Start HIGH to avoid reset
int PulseCount = 0; //Pulse count from X-RAY
int Output = 0;//Switch state on the Pre-Amp
int wait = 0;//wait for pulses count
int N = 20;//no. of pulses to count before switching states
volatile int IRQcount = 0;
volatile boolean reset_flag = false;

unsigned long start_time = 0;
unsigned long current_time = 0;

//----------------------------USER DEFINED FUNCTIONS---------------------------------
void fsm();
void loop();
void setup();
void WDT_RESET();
void IRQcounter();
void CountPulses();
//-----------------------------DEBOUNCE FUNCTIONS---------------------------------------

//--------------------------------MAIN SETUP--------------------------------------

void setup()
{

  Serial.begin(115200);

  //Pin Setup
  pinMode(LASER_PIN, INPUT_PULLUP);
  pinMode(RESET_PIN, INPUT_PULLUP);
  attachInterrupt(digitalPinToInterrupt(LASER_PIN), IRQcounter, RISING);//attach interrupt handler to laser input
  attachInterrupt (digitalPinToInterrupt (RESET_PIN), RESET_ISR, FALLING);  // attach interrupt handler to reset, wait for user press button or switch
  start_time = millis();   //initial start time
  sei();//Turn on Interrupts

    WaitForPulses();//Waits to detect 20 pulses
}

//--------------------------------MAIN LOOP----------------------------------
void loop()
{

 current_time = millis();
 fsm();//State machine
}

//--------------------------------PULSE COUNT FUNCTION--------------------------------------------

void CountPulses()
{
  //  current_time = millis();
  if ((current_time - start_time) >= period)
  {
    start_time = current_time;
    cli();//disable interrupts
    PulseCount = IRQcount;
    IRQcount = 0;
    Serial.print(F("Pulse Count is = "));
    Serial.println(PulseCount);
    sei();//enable interrupts
  }
}

//--------------------------------STATE MACHINE FUNCTION--------------------------------------------
void fsm()
{
  switch (fsm_state)
  {

    case STATE_00:

/////////Print Statement only for debugging//////////
        while (only_for_print == false)
        {
            Serial.println("The state is 00");
            only_for_print = true;
        }

///////// Count Pulses Setup /////////////////
            current_time = millis();
            CountPulses();
            Output = 0;
            if (PulseCount == N)
            {
              PulseCount = 0;//Reset Pulse Count
              only_for_print = false; //used only for print statments
              fsm_state = STATE_01;//switch to next state
            }
      break;

    case STATE_01:
/////////Print Statement only for debugging//////////
      while (only_for_print == false)
      {
          Serial.println("The state is 01");
          only_for_print = true;
      }

///////// Count Pulses Setup /////////////////
          current_time = millis();
          CountPulses();
          Output = 2;
          if (PulseCount == N)
          {
            PulseCount = 0;//Reset Pulse Count
            only_for_print = false; //used only for print statments
            fsm_state = STATE_10;//switch to next state
          }
      break;

    case STATE_10:
/////////Print Statement only for debugging//////////
      while (only_for_print == false)
      {
          Serial.println("The state is 10");
          only_for_print = true;
      }

///////// Count Pulses Setup /////////////////
          current_time = millis();
          CountPulses();
          Output = 3;
          if (PulseCount == N)
          {
            PulseCount = 0;//Reset Pulse Count
            only_for_print = false; //used only for print statments
            fsm_state = STATE_11;//switch to next state
          }

      break;

    case STATE_11:
/////////Print Statement only for debugging//////////
      while (only_for_print == false)
      {
          Serial.println("The state is 11");
          only_for_print = true;
      }
///////// Count Pulses Setup /////////////////
          current_time = millis();
          CountPulses();
          Output = 4;
          if (PulseCount == N)
          {
            PulseCount = 0;//Reset Pulse Count
            only_for_print = false; //used only for print statments
            fsm_state = STATE_00;//switch to next state
          }

      break;

    default:
      fsm_state = STATE_00;
      break;
  }

}

//----------------------------------RESET SWITCH ISR-------------------------------------

void RESET_ISR()
{
  reset_flag = true;
  if(reset_flag == true)
    {
     // Serial.println("System will now Reset");// Only for debugging
      reset_flag = false;//Reset reset switch flag
      wdt_enable(WDTO_500MS);//Reset after 0.5 seconds
      while (1)
       {
         // wdt_reset();          // uncomment to avoid reboot
       }
    }
}

//-----------------------PULSE COUNT ISR---------------------------------------

void IRQcounter()
{
  IRQcount++;
}
//-----------------------WAIT FOR PULSES---------------------------------------
void WaitForPulses()
{
  while(wait<20)
 {
    if (bit_is_set(EIFR, INTF0))
    {
      Serial.println("Pulse is detected ");
      wait++;
    }
 }
 wait = 0;//reset
}
*/

[![edited image][3]][3]
The serial monitor is shown below with added reset switch on pin 3 using watch dog timer library .
 Pulse is detected
Pulse is detected
Pulse is detected
Pulse is detected
Pulse is detected
Pulse is detected
Pulse is detected
Pulse is detected
Pulse is detected
Pulse is detected
Pulse is detected
Pulse is detected
Pulse is detected
Pulse is detected
Pulse is detected
Pulse is detected
Pulse is detected
Pulse is detected
Pulse is detected
Pulse is detected
The state is 00
Pulse Count is = 112
Pulse Count is = 20
The state is 01
Pulse Count is = 20
The state is 10
Pulse Count is = 20
The state is 11
Pulse Count is = 20
The state is 00
Pulse Count is = 20
The state is 01
Pulse Count is = 20
The state is 10
Pulse Count is = 20
The state is 11
Pulse Count is = 20
The state is 00
Pulse Count is = 20
The state is 01
Pulse Count is = 20
The state is 10
Pulse Count is = 20
The state is 11
Pulse Count is = 20
The state is 00
Pulse Count is = 20
The state is 01
Pulse Count is = 20
The state is 10
Pulse Count is = 20
The state is 11
Pulse Count is = 20

Important note:
After reading (again) your other question and its answers: You are stressing the input of your Arduino with negative voltages! Please set the offset of the signal to 2.5V (the middle between GND and VCC) and the amplitude to 5Vpp. The signal must neither be lower than GND nor higher than VCC! The input might withstand this for a while but given enough time and power it will get damaged.
Analysis of your problem:
1. The measurement of the period
Let's take a look at a "condensed" version of your time code:
void setup()
{
  startMillis = millis();
}

void loop()
{
  currentMillis = millis();
  if (currentMillis - startMillis <= period)
  {
    startMillis = currentMillis;
  }
}

I'm sure you see it now, too! Because right at the first call of loop() the time passed since setup() is short, the condition is true and startMillis is updated to the current time. This is repeated ever and ever again. The condition will always evaluate as true.
2. The number of pulses
In the function CountPulses() the counter is reset at the beginning. Then after some undefined very short duration (because your if-condition is always true) it is read. Chances are low for a pulse to be counted in that time span.
Additional note:
Just one more tip. You can define and use your own data types to show your intentions. For example the states look so much better like shown below, and you'll get free error messages from code analyzers.
typedef enum {
    STATE_00, STATE_01, STATE_10, STATE_11,
} fsm_state_type;
fsm_state_type fsm_state = STATE_00;

EDIT after you added new informations:
Item #2
Why do you think you need to debounce the laser pulse? Is it generated by a mechanical switch? Only those need debouncing. If the pulses are generated from some electronic circuit they should be clean.
Item #4
You can reset the IRQcount and then wait for it to count up.
But as this involves disabling and enabling the interrupt and reading an int just for 1 event, I'd rather set a flag if the interrupt occurs. Then the FSM could wait for the flag to be set.
Another alternative is to poll the input pin directly and to wait for the leading edge. But for this the pulse has to be wide enough.
As @EdgarBonet pointed out it will be even simpler to poll the interrupt flag. But IIRC the interrupt has to be disabled for this, else the call of the interrupt service routine will clear the flag with no chance for the main program to see it.

A better alternative is to poll the interrupt flag (i.e. if (bit_is_set(EIFR, INTF0)) { ... }). Then you don't need a wide pulse: once the hardware detects the rising edge, the flag is set and remains set until you explicitly clear it (EIFR = _BV(INTF0);).

here is where i am having the difficulty from transition from delay() to millis() :  when adding the delay() function, the program is able to count the number of pulses, now removing it and replacing with millis() function, the program is too fast to count the pulses (always shows 0 pules) . I have tried lowering the baud rate but and changing the settings for millis() function with different periods, but it doesnt help.

Well, step away from the source code and make a design. Don't program by accident, think and plan. You know that you need some certain period as the source shows. Now use it. What would you do as a human to tackle the task? millis() can be compared to a look at the wall clock.

Re “Another alternative is to poll the input pin [...]. But for this the pulse has to be wide enough.”: A better alternative is to poll the interrupt flag (i.e. if (bit_is_set(EIFR, INTF0)) { ... }). Then you don't need a wide pulse: once the hardware detects the rising edge, the flag is set and remains set until you explicitly clear it (EIFR = _BV(INTF0);).

@EdgarBonet Thanks for reminding me to this. I took the liberty to quote you.

Re “IIRC the interrupt has to be disabled for this [...]”: You do recall correctly. ;-)

I am little confused, when i use if (bit_is_set(EIFR, INTF0)) { ... } , it returns a 0 which tells me that the interrupt flag ITF0 is not set in EIFR register. In order to test it out i put a print statement in the if statement which always executes when i turn on the waveform generator and stops executing when i turn it off which tells me that ITF0 is set and cleared, so i am not sure what is going on , any clarifications ?

Would you mind to post the code for this?

Oh, and please do this by editing your question, and putting some informational words around it so that others don't have to dig deep in the comments.


text:
Ramping up and down arduino motor due to ultrasonic sensor input
Im working on an arduino robot that needs to follower a leader robot infront of it. The leader robot can accelerate, decelerate , and stop and my robot needs to be able to follow the leader without crashing into it.
I have my two sensors working however Im having a harder time integrating the motors to ramp up or down. Currently only one wheel turns on at a time for the right and left commands.
How can I appropriatly ramp up or down the wheel speed.
int SpRMotor = 5;  //speed Right Motor
int MotorA1 = 7; //Right Motor = +
int MotorA2 = 6; //Right Motor = -
int MotorB1 = 8; //Left Motor = -
int MotorB2 = 9; //Left Motor = +
int SpLMotor = 10;  //speed Left Motor

int TriggerPIN1 = 3;//right
int EchoPIN1 = 2;
int TriggerPIN2 = 12;//left
int EchoPIN2 = 11;

void setup(){
  pinMode(TriggerPIN1,OUTPUT);
  pinMode(EchoPIN1,INPUT);
  pinMode(TriggerPIN2,OUTPUT);
  pinMode(EchoPIN2,INPUT);

  pinMode(MotorB1, OUTPUT);
  pinMode(MotorB2, OUTPUT);
  pinMode(MotorA1, OUTPUT);
  pinMode(MotorA2, OUTPUT);
  pinMode(SpLMotor, OUTPUT);
  pinMode(SpRMotor, OUTPUT);

  analogWrite(SpRMotor, 170);
  analogWrite(SpLMotor, 170);
  Serial.begin(9600);
  }
void loop(){

  int limit;
  int sampledata1, sampledata2;
  sampledata1 = distance(TriggerPIN1, EchoPIN1);
  Serial.print("distance1: ");
  Serial.print(sampledata1);
  delay(100);
  sampledata2 = distance(TriggerPIN2, EchoPIN2);
  Serial.print(" distance2: ");
  Serial.println(sampledata2);
  delay(100);
  limit = 10;
  if((15> sampledata1 >= limit)&&(15> sampledata2 >= limit))
  {
    Serial.print("True");
    forward();
    delay(100);
  }
     if (sampledata2  >= 15 )
    {turnRight();}
  if (sampledata1  >= 15 )
    {turnLeft();}
  if ((limit > sampledata1)&&(limit> sampledata2 ))
  {
    Stop();
  }

}

void forward(){
digitalWrite(MotorA1, LOW);
digitalWrite(MotorA2, HIGH);
digitalWrite(MotorB1, HIGH);
digitalWrite(MotorB2, LOW);
}

void turnRight(){
digitalWrite(MotorA1, LOW);
digitalWrite(MotorA2, LOW);
digitalWrite(MotorB1, HIGH);
digitalWrite(MotorB2, LOW);
}

void turnLeft(){
digitalWrite(MotorA1, LOW);
digitalWrite(MotorA2, HIGH);
digitalWrite(MotorB1, LOW);
digitalWrite(MotorB2, LOW);
}

void Stop(){
digitalWrite(MotorA1, LOW);
digitalWrite(MotorA2, LOW);
digitalWrite(MotorB1, LOW);
digitalWrite(MotorB2, LOW);
}
int distance(int trig, int echo)
{ digitalWrite(trig,LOW);
  delayMicroseconds(2);
  digitalWrite(trig,HIGH);
  delayMicroseconds(10);
  digitalWrite(trig,LOW);
  long timedelay = pulseIn(echo,HIGH);
  int distance = 0.0343 * (timedelay/2);

  return distance;
}

The speed seams to be defined by a an analog write to SpRMotor and SpLMotor. You did that once (with value 170)  in the setup. If you use variables for that (e.g. speedValueL and speedValueR) you can change their values as you need it and write it to the PWM channels on each forward, backward, left or right statement.
A short example:
int SpRMotor = 5;  //speed Right Motor
int MotorA1 = 7; //Right Motor = +
int MotorA2 = 6; //Right Motor = -
int MotorB1 = 8; //Left Motor = -
int MotorB2 = 9; //Left Motor = +
int SpLMotor = 10;  //speed Left Motor

int TriggerPIN1 = 3;//right
int EchoPIN1 = 2;
int TriggerPIN2 = 12;//left
int EchoPIN2 = 11;

int speedValueL = 0;
int speedValueR = 0;

void setup()
{
  pinMode(TriggerPIN1,OUTPUT);
  pinMode(EchoPIN1,INPUT);
  pinMode(TriggerPIN2,OUTPUT);
  pinMode(EchoPIN2,INPUT);

  pinMode(MotorB1, OUTPUT);
  pinMode(MotorB2, OUTPUT);
  pinMode(MotorA1, OUTPUT);
  pinMode(MotorA2, OUTPUT);
  pinMode(SpLMotor, OUTPUT);
  pinMode(SpRMotor, OUTPUT);

  analogWrite(SpRMotor, speedValueR);
  analogWrite(SpLMotor, speedValueL);

  Serial.begin(9600);
}

void loop()
{
  int limit;
  int sampledata1, sampledata2;
  sampledata1 = distance(TriggerPIN1, EchoPIN1);
  Serial.print("distance1: ");
  Serial.print(sampledata1);
  delay(100);
  sampledata2 = distance(TriggerPIN2, EchoPIN2);
  Serial.print(" distance2: ");
  Serial.println(sampledata2);
  delay(100);
  limit = 10;
  if( (15> sampledata1 >= limit) && (15> sampledata2 >= limit) )
  {
    Serial.print("True");
    // Just my guess - do what fits for you
    speedValueL = 170;
    speedValueR = 170;

    forward();
    delay(100);
  }

  if (sampledata2  >= 15 )
  {
    // Just my guess - do what fits for you
    speedValueL = 200;
    speedValueR = 0;

    turnRight();
  }

  if (sampledata1  >= 15 )
  {
    // Just my guess - do what fits for you
    speedValueL = 0;
    speedValueR = 200;

    turnLeft();
  }

  if ( ( limit > sampledata1 ) && ( limit> sampledata2 ) )
  {
    // Just my guess - do what fits for you
    speedValueL = 0;
    speedValueR = 0;

    Stop();
  }
}

void forward()
{
  analogWrite(SpRMotor, speedValueR);
  analogWrite(SpLMotor, speedValueL);

  digitalWrite(MotorA1, LOW);
  digitalWrite(MotorA2, HIGH);
  digitalWrite(MotorB1, HIGH);
  digitalWrite(MotorB2, LOW);
}

void turnRight()
{
  analogWrite(SpRMotor, speedValueR);
  analogWrite(SpLMotor, speedValueL);

  digitalWrite(MotorA1, LOW);
  digitalWrite(MotorA2, LOW);
  digitalWrite(MotorB1, HIGH);
  digitalWrite(MotorB2, LOW);
}

void turnLeft()
{
  analogWrite(SpRMotor, speedValueR);
  analogWrite(SpLMotor, speedValueL);

  digitalWrite(MotorA1, LOW);
  digitalWrite(MotorA2, HIGH);
  digitalWrite(MotorB1, LOW);
  digitalWrite(MotorB2, LOW);
}

void Stop()
{
  analogWrite(SpRMotor, speedValueR);
  analogWrite(SpLMotor, speedValueL);

  digitalWrite(MotorA1, LOW);
  digitalWrite(MotorA2, LOW);
  digitalWrite(MotorB1, LOW);
  digitalWrite(MotorB2, LOW);
}

int distance( int trig, int echo )
{
  digitalWrite( trig, LOW );
  delayMicroseconds( 2 );
  digitalWrite( trig, HIGH );
  delayMicroseconds( 10 );
  digitalWrite( trig, LOW );
  long timedelay = pulseIn( echo, HIGH );
  int distance = 0.0343 * ( timedelay / 2);

  return distance;
}


text:
How can i send data to phpmyadmin database? using esp8266 nodemcu and max30100
i want to send data from my sensor to database phpmyadmin. but i only get zero values. please help me thank you.
void loop()
{
  pox.update();
  BPM = pox.getHeartRate();
  SpO2 = pox.getSpO2();
 // Sending_To_phpmyadmindatabase(BPM);

  if (millis() - tsLastReport > REPORTING_PERIOD_MS) {
    Serial.print("BPM: ");
    Serial.println(BPM);
    Serial.print("SpO2: ");
    Serial.print(SpO2);
    Serial.println("%");
    Serial.println("*********************************");
    Serial.println();
    tsLastReport = millis();
    delay(0);
    }
    Sending_To_phpmyadmindatabase(BPM);
}

void Sending_To_phpmyadmindatabase(float BPM){
  if (client.connect(server_addr,80)) {
    Serial.println("connected");
    Serial.print("GET /pulse.php?BPM=12");
    client.print("GET /pulse.php?pox.getHeartRate="+String(BPM,1));
    Serial.println("pox.getHeartRate!");
    client.println("pulse=");
    client.println(BPM);
   // Serial.print("GET /vsmonitor/connect.php?SpO2=12");
   // client.print("GET /vsmonitor/connect.php?SpO2="+String(SpO2,1));
   // Serial.println("SpO2!");
    //client.println("o2_sat=");
    //client.println(SpO2);
    client.print(" ");
    client.println(" HTTP/1.1");
    client.println("Host: 192.168.15.4");
    client.println(server_addr);
    client.println("Connection: close");
    client.println();
  }
  else {
    Serial.println("--> connection failed\n");
  }
  Serial.println();
  delay(5000);
}

so, where is the problem? ... you have a bunch of Serial.print() functions ... why did you not say what is being printed?

your question is like i want to boil water from a well, but i can't ... several scenarios are possible ... no water in well, no bucket to carry water, no pot to boil water, no  stove, no gas for fire, no electricity .... i think that you get the idea

the problem starts when i call the void Sending_To_phpmyadmindatabase(BPM);. i get zero values. example BPM 0.0 in serial monitor. and in database is 0

Sending_To_phpmyadmindatabase(BPM); slowers down m output i dont know why, it works perfectl when i remove the Sending_To_phpmyadmindatabase(BPM);.

remove ln from the second url parameter prints. and what should client.print(" "); do?

@CodeGorilla, do some research into how HTTP GET requests work. They're really useful. Don't be fooled by the name "GET". A GET request "gets" a URL from the web server, receiving data in return or just a simple acknowledgement, but also offering the opportunity of sending data from the client as part of the URL parameters (like ?parameter1=value1&parameter2=value2 etc.). It's often the simplest way of sending small amounts of data to a web server.


text:
xQueueGenericReceive error on ESP32 (using FastLED which relies on FreeRTOS) for adapted MeteorRain LED animation
I'm trying to adapt the MeteorRain animation from Tweaking4All to work on segments of my light string (vs using the entire string) and I'm getting an error in FastLED.show() (on a line that is used repeatedly with the same variables before it crashes the "ESP32 DEVKIT V1"). The decode of the ESP32 shows an error in clockless_rmt_esp32.h (which is about as far as I have visibility and ability to troubleshoot the problem.)
Looking through Google results, I find people who have the same error, usually related to memory allocation, but I can't make a connection to FastLED.
The code:
#define FASTLED_INTERNAL // add this before including FastLED.h
#include <FastLED.h>

#define LED_PIN     12
#define COLOR_ORDER RGB
#define CHIPSET     WS2811
#define PIXELSECTIONS 2     // there are two segments of christmas lights
#define HORZPIXELS 5        // with 5 lights across connected to
#define VERTPIXELS 12       // 7 lights that hang vertically
#define NUM_LEDS (HORZPIXELS + VERTPIXELS) * PIXELSECTIONS
#define NUM_COLS PIXELSECTIONS
#define NUM_ROWS VERTPIXELS + HORZPIXELS
#define BRIGHTNESS  50

CRGB rawleds[NUM_LEDS];
CRGBSet leds(rawleds, NUM_LEDS);

unsigned long animationsCycleStartTime = millis();
int genericCounter=0;

void setup() {
  // Initialize serial and wait for port to open:
  Serial.begin(115200);
  // This delay gives the chance to wait for a Serial Monitor without blocking if none is found
  delay(1500);

  FastLED.addLeds<CHIPSET, LED_PIN, COLOR_ORDER>(rawleds, NUM_LEDS).setCorrection( TypicalLEDStrip );
  FastLED.setBrightness( BRIGHTNESS );
}

void loop() {
   meteorRain(0xff,0xff,0xff,10, 64, true, 30);
}

void meteorRain(byte red, byte green, byte blue, byte meteorSize, byte meteorTrailDecay, boolean meteorRandomDecay, int SpeedDelay) {

  int metaNUM_LEDS = (HORZPIXELS + VERTPIXELS);
  for(int i = 0; i < metaNUM_LEDS+metaNUM_LEDS; i++) {

    // fade brightness all LEDs one step
    for(int j=0; j<metaNUM_LEDS; j++) {
      if( (!meteorRandomDecay) || (random(10)>5) ) {
        metaFadeToBlack(j, meteorTrailDecay );
      }
    }

    // draw meteor
    for(int j = 0; j < meteorSize; j++) {
      if( ( i-j <metaNUM_LEDS) && (i-j>=0) ) {
Serial.print("i=" + String(i) + ";j=" + String(j) + ";i-j=" + String(i-j));
        metaSetPixel(i-j, red, green, blue);
Serial.println(" done");
      }
    }
Serial.println("to show");
    FastLED.show();
Serial.println("to wait");
    delay(SpeedDelay);
  }
  genericCounter = (genericCounter>=PIXELSECTIONS) ? 0 : genericCounter+1 ;
}

void fadeToBlack(int ledNo, byte fadeValue) {
 #ifdef ADAFRUIT_NEOPIXEL_H
    // NeoPixel
    uint32_t oldColor;
    uint8_t r, g, b;
    int value;

    oldColor = strip.getPixelColor(ledNo);
    r = (oldColor & 0x00ff0000UL) >> 16;
    g = (oldColor & 0x0000ff00UL) >> 8;
    b = (oldColor & 0x000000ffUL);

    r=(r<=10)? 0 : (int) r-(r*fadeValue/256);
    g=(g<=10)? 0 : (int) g-(g*fadeValue/256);
    b=(b<=10)? 0 : (int) b-(b*fadeValue/256);

    strip.setPixelColor(ledNo, r,g,b);
 #endif
 #ifndef ADAFRUIT_NEOPIXEL_H
   // FastLED
   leds[ledNo].fadeToBlackBy( fadeValue );
 #endif
}

// this method transposes the relative pixel to the actual pixel
// for example, on the second pass of loop the code says to use
// pixels 0-16 but since the genericCounter is at 1 this method
// activates pixels 17-33
void metaSetPixel(int metaPixel, byte red, byte green, byte blue) {
  int actualPixel = (genericCounter * (HORZPIXELS + VERTPIXELS)) + metaPixel;
  setPixel( actualPixel, red, green, blue);
}

void metaFadeToBlack (int metaPixel, byte meteorTrailDecay) {
  int actualPixel = (genericCounter * (HORZPIXELS + VERTPIXELS)) + metaPixel;
  fadeToBlack(actualPixel, meteorTrailDecay );
}

void setPixel(int Pixel, byte red, byte green, byte blue) {
   // FastLED
   rawleds[Pixel].r = red;
   rawleds[Pixel].g = green;
   rawleds[Pixel].b = blue;
}

void setAll(byte red, byte green, byte blue) {
  for(int i = 0; i < NUM_LEDS; i++ ) {
    setPixel(i, red, green, blue);
  }
  FastLED.show();
}

The raw error from Serial console trace:
13:50:53.499 -> ⸮⸮�⸮�⸮⸮⸮�@#P#⸮N⸮1h⸮0,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
13:50:53.499 -> mode:DIO, clock div:1
13:50:53.499 -> load:0x3fff0018,len:4
13:50:53.499 -> load:0x3fff001c,len:1044
13:50:53.499 -> load:0x40078000,len:10124
13:50:53.499 -> load:0x40080400,len:5856
13:50:53.499 -> entry 0x400806a8
13:50:55.042 -> i=0;j=0;i-j=0 done
13:50:55.042 -> to show
13:50:55.076 -> to wait
13:50:55.076 -> i=1;j=0;i-j=1 done
13:50:55.076 -> i=1;j=1;i-j=0 done
13:50:55.076 -> to show
13:50:55.110 -> to wait
...[snip]...
13:51:01.299 -> to show
13:51:01.299 -> to wait
13:51:01.334 -> i=0;j=0;i-j=0 done
13:51:01.334 -> to show
13:51:01.334 -> /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/queue.c:1443 (xQueueGenericReceive)- assert failed!
13:51:01.334 -> abort() was called at PC 0x40085e41 on core 1
13:51:01.334 ->
13:51:01.334 -> ELF file SHA256: 0000000000000000
13:51:01.334 ->
13:51:01.334 -> Backtrace: 0x40084e74:0x3ffb1df0 0x400850e9:0x3ffb1e10 0x40085e41:0x3ffb1e30 0x400d1371:0x3ffb1e70 0x400d171d:0x3ffb1e90 0x400d1801:0x3ffb1ed0 0x400d11bb:0x3ffb1f10 0x400d125b:0x3ffb1f80 0x400d2231:0x3ffb1fb0 0x400860f9:0x3ffb1fd0
13:51:01.372 ->
13:51:01.372 -> Rebooting...
13:51:01.372 -> ets Jun  8 2016 00:22:57
13:51:01.372 ->
13:51:01.372 -> rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
13:51:01.372 -> configsip: 0, SPIWP:0xee
13:51:01.372 -> clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
13:51:01.372 -> mode:DIO, clock div:1
13:51:01.372 -> load:0x3fff0018,len:4
13:51:01.408 -> load:0x3fff001c,len:1044
13:51:01.408 -> load:0x40078000,len:10124
13:51:01.408 -> load:0x40080400,len:5856
13:51:01.408 -> entry 0x400806a8

The decoded error:
Decoding stack results
0x40084e74: invoke_abort at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp32/panic.c line 156
0x400850e9: abort at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp32/panic.c line 171
0x40085e41: xQueueGenericReceive at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/queue.c line 1443
0x400d1371: ClocklessController12, 77, 77, 154, (EOrder)10, 0, false, 5>::showPixels(PixelController(EOrder)10, 1, 4294967295u>&) at /Users/jaireaux/Documents/Arduino/libraries/FastLED/platforms/esp/32/clockless_rmt_esp32.h line 288
0x400d171d: CPixelLEDController(EOrder)10, 1, 4294967295u>::show(CRGB const*, int, CRGB) at /Users/jaireaux/Documents/Arduino/libraries/FastLED/controller.h line 408
0x400d1801: CFastLED::show(unsigned char) at /Users/jaireaux/Documents/Arduino/libraries/FastLED/controller.h line 90
0x400d11bb: meteorRain(unsigned char, unsigned char, unsigned char, unsigned char, unsigned char, bool, int) at /Users/jaireaux/Documents/Arduino/libraries/FastLED/FastLED.h line 500
0x400d125b: loop() at /Users/jaireaux/Documents/Arduino/temp/temp.ino line 33
0x400d2231: loopTask(void*) at /Users/jaireaux/Library/Arduino15/packages/esp32/hardware/esp32/1.0.6/cores/esp32/main.cpp line 23
0x400860f9: vPortTaskWrapper at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/port.c line 143


text:
Serial communication not working between two Arduinos unless connected to computer
I have a robot with an Arduino Mega that gets data from a bluetooth module and sends it to an Arduino Leonardo to activate some functions. It all works amazing but only if the boards are connected to my computer. As soon as I disconnect them and power them from their own batteries, the serial communications seems to stop working. When I connect it to the PC again the communication between the Arduinos begins working.
Does anyone know why this is happening?
The Mega is powered by a 9V battery and the Leonardo by 4x AA (6V). On the Mega I use TX/RX(2) for communication with the BT module and TX/RX(3) for communication to the Leonardo.

By "stop working" do you mean the RX / TX LEDs don't blink? They never do unless the board is powered by USB.

Nope,from the Arduino Mega I am using TX2/RX2 to communicate with the bluetooth module, and TX3/RX3 to communicate with the arduino leonardo. by not working I mean that the arduino leonardo stops getting data from the MEGA. This only happens when I use a power bank or 9V Battery instead of connecting it directly to the Computer

Can you draw a diagram of how they're connected together? It might be that you need to pair the Mega ground to the Leonardo ground, otherwise the voltages will be all at sixes and sevens.

So the problem may be the change of voltage?

The Mega ends up with 9V and the Leonardo with 6.

Does each board have its own power supply, or does it all come from one place? A diagram really would help - one of how it looks when connected to the PC and one when it isn't. It doesn't need to be a work of art; a picture paints a thousand words and answers twice as many questions!

Great, let me make a simple understandable diagram and I'll upload it

While I am doing that, I'll try to explain. The arduino Leonardo uses 4 AA batteries, and the Mega uses 1 9V battery. They are connected via serial port and they do what they are told to do, but only if they are both connected to the computer and not to their power supplies

Connect any GND pin from one board to any GND pin on the other.

Amazing!! That solved the problem! Thanks a lot. So common ground is important when using different circuits with different power supplies. Why is that?

I'll add a proper answer now I know your situation. I'll also edit your question a little so it helps others in the same boat.

Voltage, Electrical Potential, Potential Difference, Electric Tension - whatever you refer to it as - is the always measured between two points.
Generally of course we mean two points within one circuit, and most of the time we mean between something and the circuit's 0-Volt rail; it's implied whenever somebody quotes a voltage, unless they specifiy otherwise.
We always refer to the 0-Volt rail as 'ground', no doubt stemming from the term 'earth', which is literally a connnection into the ground itself. In the case of a battery powered circuit, the 0-volt rail is only 0 Volts referenced to the rest of the circuit. In such a circumstance, the circuit's ground is said to be floating when referenced to another circuit. Thus, two circuits with independent power supplies and no interconnection cannot be compared to one another in sense of voltage.
This typically doesn't matter, but when you need to interconnect independently-powered circuits you run into a problem. As both grounds are floating, any other voltage on each circuit is referenced to said floating voltage, and therefore is also floating. This makes wired communication between them impossible.
Unless you create a voltage reference between the two.
Simply connect the ground rails of each together; the cicruits are then referenced to one another at 0 Volts. It doesn't have to be the ground rails that are connected - any two points connected together will allow you to reference any point on board A to board B and get a correct potential difference. However, it's pretty useless doing that except in some odd situations.


text:
Fading the brightness of LEDs using MAX7219 and PWM
I am doing a project with bi-color led matrix 8x8 and MAX7219 as the LED driver. I want to implement a fading effect on the LEDs, like mixing the two colors by varying the individual duty cycles.
My idea is the use of the Iset parameter; I would connect the PWM pin from Arduino through the Rset resistor and feed that into the Iset of the MAX7129 instead of 5V supply. Please suggest whether or not this is possible, if not what can be the alternative approach?

This is possible in two ways:

The MAX72xx has its own internal intensity control register. From the datasheet:

Digital control of display brightness is provided by an internal pulse-width modulator [...]. The modulator scales the average segment current in 16 steps from a maximum of 31/32 down to 1/32 of the peak current set by RSET [...].

This of course requires no extra components or effort, but you are limited slightly by only a 4-bit intensity resolution. Also, there is no 'off' so you'd have to either manually blank the displays or put the ICs into shutdown mode.

Your suggested way is possible. However, the low frequency of the Arduino's PWM may lead to flickering if the MAX7219's internal segment current reference driver needs a steady voltage. You'll have to consider smoothing the PWM output through a low pass filter - the TL072/TL082 has two op-amps so you can use one for colour A and the other for colour B. I'd choose an op-amp over passive filtering because the current drawn from the Arduino will be negligible and the stability of the current into the MAX7219 will be improved.


text:
Stuck in a small confusion about Infrared leds and receivers?
I have a very simple idea I want to implement. I am making a home automation using an Arduino Uno. I am familiar with Arduino programming but the problem is what kind of IR receiver I need to buy if i want my TV remote (or similar) to communicate with my Arduino.
Can you suggest me any example (low cost, and available in India)?

Your title says "LED", but your body says "receiver".

Aren't they same

LEDs transmits IR light. Receivers receive the (modulated) IR light. You can get IR-receivers from old VCR etc.

Element14 has an India based store, and they carry these IR devices.
Here is one for 66 rupees:
http://in.element14.com/vishay-semiconductor/tsop38238/ir-receiver-45m-38khz-th/dp/2395954?MER=MER-BPR-4PPM-SP-VSHY-OD&
You may want to do research into what the carrier frequency of your remote is also. Most are generally around 35 - 40khz, and the receiver I provided a link to is 38khz. It should work, but if you want to be safe I suggest you look it up. Or, if you have an old TV lying around, you can pull one out of that.
Hope this helps.


text:
How do you make the arduino go forward,backward and stop using Infrared?
Please give me a code and diagram use makeblock i.r sensor V2.1 and makeblock remote. It should be connected to a d.c motor that works with a h-bridge.It also has to be a dual motor which combines these two codes:
1:This one for the movement
const int controlPin1 = 2; // connected to pin 7 on the H-bridge
const int controlPin2 = 3; // connected to pin 2 on the H-bridge
const int enablePin = 9; // connected to pin 1 on the H-bridge
const int directionSwitchPin = 4; // connected to the switch for direction
const int onOffSwitchStateSwitchPin = 5; // connected to the switch for turning the motor on and off
const int potPin = A0; // connected to the potentiometer's output

// create some variables to hold values from your inputs
int onOffSwitchState = 0; // current state of the On/Off switch
int previousOnOffSwitchState = 0; // previous position of the on/off switch
int directionSwitchState = 0; // current state of the direction switch
int previousDirectionSwitchState = 0; // previous state of the direction switch

int motorEnabled = 0; // Turns the motor on/off
int motorSpeed = 0; // speed of the motor
int motorDirection = 1; // current direction of the motor

void setup()
{
    // intialize the inputs and outputs
    pinMode(directionSwitchPin, INPUT);
    pinMode(onOffSwitchStateSwitchPin, INPUT);
    pinMode(controlPin1, OUTPUT);
    pinMode(controlPin2, OUTPUT);
    pinMode(enablePin, OUTPUT);

    // pull the enable pin LOW to start
    digitalWrite(enablePin, LOW);
}

void loop()
{
    // read the value of the on/off switch
    onOffSwitchState = digitalRead(onOffSwitchStateSwitchPin);
    delay(1);

    // read the value of the direction switch
    directionSwitchState = digitalRead(directionSwitchPin);

    // read the value of the pot and divide by 4 to get
    // a value that can be used for PWM
    motorSpeed = analogRead(potPin) / 4;

    // if the on/off button changed state since the last loop()
    if (onOffSwitchState != previousOnOffSwitchState)
    {
        // change the value of motorEnabled if pressed
        if (onOffSwitchState == HIGH)
        {
            motorEnabled = !motorEnabled;
        }
    }

    // if the direction button changed state since the last loop()
    if (directionSwitchState != previousDirectionSwitchState)
    {
        // change the value of motorDirection if pressed
        if (directionSwitchState == HIGH)
        {
            motorDirection = !motorDirection;
        }
    }

    // change the direction the motor spins by talking
    // to the control pins on the H-Bridge
    if (motorDirection == 1)
    {
        digitalWrite(controlPin1, HIGH);
        digitalWrite(controlPin2, LOW);
    }
    else
    {
        digitalWrite(controlPin1, LOW);
        digitalWrite(controlPin2, HIGH);
    }

    // if the motor is supposed to be on
    if (motorEnabled == 1)
    {
        // PWM the enable pin to vary the speed
        analogWrite(enablePin, motorSpeed);
    }
    else
    { // if the motor is not supposed to be on
        //turn the motor off
        analogWrite(enablePin, 0);
    }
    // save the current On/Offswitch state as the previous
    previousDirectionSwitchState = directionSwitchState;
    // save the current switch state as the previous
    previousOnOffSwitchState = onOffSwitchState;
}

2: This one for the IR:
#include "IRremote.h"  //-----( Import needed libraries )-----
int receiver = 11; // ----- DAT pin of IR receiver to Arduino digital pin 11

/*-----( Declare objects )-----*/
IRrecv irrecv(receiver);           // create instance of 'irrecv'
decode_results results;            // create instance of 'decode_results'

void setup()    /*----( SETUP: RUNS ONCE )----*/
{
    Serial.begin(9600);  // Begin serial communication
    Serial.println("IR Receiver Raw Data + Button Decode Test");
    irrecv.enableIRIn(); // Start the receiver
}               /*--(end setup )---*/

void loop()     /*----( LOOP: RUNS CONSTANTLY )----*/
{
    if (irrecv.decode(&results)) // have we received an IR signal?
    {
        //    Serial.println(results.value);  // Uncomment to print raw decimal values
        translateIR(); // run function "translateIR"
        irrecv.resume(); // receive the next value
    }
}               /* --(end main loop )-- */

/*-----( Declare User-written Functions )-----*/
void translateIR()  // translate Makeblock remote raw values to keys
{
    switch (results.value)
    {
        case 4219133059:      Serial.println(" A ");     break;
        case 667718909:       Serial.println(" B ");     break;
        case 3478241646:      Serial.println(" C ");     break;
        case 1322193145:      Serial.println(" D ");     break;
        case 3689098103:      Serial.println(" ^ ");     break;
        // case 3478241646:      Serial.println(" E ");     break;
        case 1776008254:      Serial.println(" < ");     break;
        case 1803700378:      Serial.println(" * ");     break;
        case 3495019267:      Serial.println(" > ");     break;
        case 1943112141:      Serial.println(" 0 ");     break;

        case 3444686410:      Serial.println(" v ");     break;
        case 2806989789:      Serial.println(" F ");     break;
        case 3689098101:      Serial.println(" 1 ");     break;
        // case 3689098103:      Serial.println(" 2 ");     break;
        case 1943112142:      Serial.println(" 3 ");     break;
        case 3689098102:      Serial.println(" 4 ");     break;
        // case 3689098102:      Serial.println(" 5 ");     break;
        case 2181502997:      Serial.println(" 6 ");     break;
        case 650941290:       Serial.println(" 7 ");     break;
        case 402038415:       Serial.println(" 8 ");     break;
        case 945450753:       Serial.println(" 9 ");     break;
        default:     Serial.println(" other button   ");
    }

    delay(250);
} //END translateIR

Please provide a bit more information on what you're using, and what research you've done so far.

You should be able to search on Google and get a library to interface with the sensor.  Then you will need some motors, a motor controller, and a library to control that.  Then you will need to stick it all together using your code.
What you need to do is:

Search for your IR library and a tutorial.
Search for a Stepper motor tutorial and library.
Then post a question when you are stuck with that.

You need a good IR Library, or tons of low-level knowledge.
Ken Shirriff wrote the best IR library out there! Here it is.
Adafruit writes awesome tutorials too. Here's one.