Compiling question from a beginner

Grandson downloaded a simple sketch for a tank and controller (wireless) The sketch was written for a UNO ( tank side ) and a NANO ( controller side). But he got 2 Mega 2560 and a tank kit for Christmas. We he tried to compiled the sketches with out having either board hooked up to the computer he got this.
" Error compiling for board Ardunino/Genuino mega or mega 2560. He never had this problem running other sketches ( Blink--sweep-ect ) ( he is using a Sparkfun learning book/kit for the other sketches. Can any one help a pure beginner.

Can you post the code that he tried to upload and the error message(s) from the attempt.

Read the how to use this forum-please read sticky to see how to properly post code and errors and some advice on how to ask an effective question. Remove useless white space and format the code with the IDE autoformat tool (crtl-t or Tools, Auto Format) before posting code.

Please include the entire error message. It is easy to do. There is a button (lower right of the IDE window) called "copy error message". Copy the error and paste into a post in code tags. Paraphrasing the error message leaves out important information.

Sorry, how do we get from " quick reply" screen to the insert code screen? With out copy and pasting?

chickenhawk:
Sorry, how do we get from " quick reply" screen to the insert code screen? With out copy and pasting?

Click on the "Preview" box and you will get the editing tools so you can insert the code.

To post code the right way:

  1. In the IDE, highlight the code.
  2. Right click and copy the code.
  3. In a forum post, click the </> button (left end of the tool icons, above).
  4. The cursor should be between and .
  5. Right click and paste the code between the code tags ( your code here ).

The same procedure for the errors except copy the error with the "copy error message" button in the IDE.

Sorry we did it wrong, we started a new post, instead of posting hear. Please see new post under the same question.

Sorry

@chickenhawk

How many more of the same do I need to deal with.

Other post/duplicate DELETED
Please do NOT cross post / duplicate as it wastes peoples time and efforts to have more than one post for a single topic.

Could you take a few moments to Learn How To Use The Forum.
It will help you get the best out of the forum in the future.
Other general help and troubleshooting advice can be found here.

OP code from other post.

/*
 * If you use the serial monitor for debugging remember to ster the baud rate to 115200.
 * The modules are set to only one-way communication. That means that the controller can only transmit and the tank can only receive.
 * If you wish to change this for two-way communication there is plenty of documentation to do so on the internet and in examples.
 *
 * This program reads the analog input of the joystick and sends it in packets to te tank.
 */
#include <SPI.h> 
#include "RF24.h"

RF24 myRadio (7, 8);
byte addresses[][6] = {"0"};

struct package
{
  int X=1;
  int Y=1;
};


typedef struct package Package;
Package data;


void setup()
{
  Serial.begin(115200);
  delay(100);
  myRadio.begin(); 
  myRadio.setChannel(115);
  myRadio.setPALevel(RF24_PA_MIN);
  myRadio.setDataRate( RF24_250KBPS ) ;
  myRadio.openWritingPipe( addresses[0]);
  delay(100);
}

void loop()
{
 
  myRadio.write(&data, sizeof(data));

  Serial.print("X:");
  Serial.print(data.X);
  Serial.print("    Y");
  Serial.println(data.Y);
  data.X = analogRead(A0);
  data.Y = analogRead(A1);
  delay(100);
}

The code compiles without errors or warnings for me (IDE ver 1.8.5, board Mega 2560).

What is the error that you see?

exit status 1
Error compiling for board Arduino/Genuino Mega or Mega 2560.

Is that the whole error message ?

Yes that is what it says at the bottom of the page when he tries to compile it

In the IDE go to File, Preferences and enable verbose output for compiling. Then try to compile and post the error output.

chickenhawk:
Yes that is what it says at the bottom of the page when he tries to compile it

What do you see if you scroll up or even better use the Copy error messages button in the IDE ?

Same thing

Please humour me. Compile the program and when the error occurs click the Copy error messages button and paste what is copied into code tags in a post here

Arduino: 1.8.5 (Windows 10), Board: "Arduino/Genuino Mega or Mega 2560, ATmega2560 (Mega 2560)"

C:\Program Files (x86)\Arduino\arduino-builder -dump-prefs -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -hardware C:\Users\Lavandier\AppData\Local\Arduino15\packages -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -tools C:\Users\Lavandier\AppData\Local\Arduino15\packages -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries C:\Users\Lavandier\Documents\Arduino\libraries -fqbn=arduino:avr:mega:cpu=atmega2560 -ide-version=10805 -build-path C:\Users\LAVAND~1\AppData\Local\Temp\arduino_build_263661 -warnings=all -build-cache C:\Users\LAVAND~1\AppData\Local\Temp\arduino_cache_142444 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.arduinoOTA.path=C:\Users\Lavandier\AppData\Local\Arduino15\packages\arduino\tools\arduinoOTA\1.3.0 -prefs=runtime.tools.avrdude.path=C:\Users\Lavandier\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17 -prefs=runtime.tools.avr-gcc.path=C:\Users\Lavandier\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino5 -verbose C:\Users\Lavandier\Downloads\tank\Controller\Controller.ino
C:\Program Files (x86)\Arduino\arduino-builder -compile -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -hardware C:\Users\Lavandier\AppData\Local\Arduino15\packages -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -tools C:\Users\Lavandier\AppData\Local\Arduino15\packages -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries C:\Users\Lavandier\Documents\Arduino\libraries -fqbn=arduino:avr:mega:cpu=atmega2560 -ide-version=10805 -build-path C:\Users\LAVAND~1\AppData\Local\Temp\arduino_build_263661 -warnings=all -build-cache C:\Users\LAVAND~1\AppData\Local\Temp\arduino_cache_142444 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.arduinoOTA.path=C:\Users\Lavandier\AppData\Local\Arduino15\packages\arduino\tools\arduinoOTA\1.3.0 -prefs=runtime.tools.avrdude.path=C:\Users\Lavandier\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17 -prefs=runtime.tools.avr-gcc.path=C:\Users\Lavandier\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino5 -verbose C:\Users\Lavandier\Downloads\tank\Controller\Controller.ino
Using board 'mega' from platform in folder: C:\Users\Lavandier\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.1
Using core 'arduino' from platform in folder: C:\Users\Lavandier\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.1
Detecting libraries used...
"C:\Users\Lavandier\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino5/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO=10805 -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR "-IC:\Users\Lavandier\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.1\cores\arduino" "-IC:\Users\Lavandier\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.1\variants\mega" "C:\Users\LAVAND~1\AppData\Local\Temp\arduino_build_263661\sketch\Controller.ino.cpp" -o "nul"
"C:\Users\Lavandier\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino5/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO=10805 -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR "-IC:\Users\Lavandier\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.1\cores\arduino" "-IC:\Users\Lavandier\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.1\variants\mega" "-IC:\Users\Lavandier\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.1\libraries\SPI\src" "C:\Users\LAVAND~1\AppData\Local\Temp\arduino_build_263661\sketch\Controller.ino.cpp" -o "nul"
"C:\Users\Lavandier\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino5/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO=10805 -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR "-IC:\Users\Lavandier\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.1\cores\arduino" "-IC:\Users\Lavandier\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.1\variants\mega" "-IC:\Users\Lavandier\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.1\libraries\SPI\src" "C:\Users\LAVAND~1\AppData\Local\Temp\arduino_build_263661\sketch\Controller.ino.cpp" -o "C:\Users\LAVAND~1\AppData\Local\Temp\arduino_build_263661\preproc\ctags_target_for_gcc_minus_e.cpp"
C:\Users\Lavandier\Downloads\tank\Controller\Controller.ino:9:10: fatal error: RF24.h: No such file or directory

#include "RF24.h"

^~~~~~~~

compilation terminated.

Using library SPI at version 1.0 in folder: C:\Users\Lavandier\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.1\libraries\SPI
exit status 1
Error compiling for board Arduino/Genuino Mega or Mega 2560.

Arduino: 1.8.5 (Windows 10), Board: "Arduino/Genuino Mega or Mega 2560, ATmega2560 (Mega 2560)"

C:\Program Files (x86)\Arduino\arduino-builder -dump-prefs -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -hardware C:\Users\Lavandier\AppData\Local\Arduino15\packages -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -tools C:\Users\Lavandier\AppData\Local\Arduino15\packages -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries C:\Users\Lavandier\Documents\Arduino\libraries -fqbn=arduino:avr:mega:cpu=atmega2560 -ide-version=10805 -build-path C:\Users\LAVAND~1\AppData\Local\Temp\arduino_build_263661 -warnings=all -build-cache C:\Users\LAVAND~1\AppData\Local\Temp\arduino_cache_142444 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.arduinoOTA.path=C:\Users\Lavandier\AppData\Local\Arduino15\packages\arduino\tools\arduinoOTA\1.3.0 -prefs=runtime.tools.avrdude.path=C:\Users\Lavandier\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17 -prefs=runtime.tools.avr-gcc.path=C:\Users\Lavandier\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino5 -verbose C:\Users\Lavandier\Downloads\tank\Controller\Controller.ino
C:\Program Files (x86)\Arduino\arduino-builder -compile -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -hardware C:\Users\Lavandier\AppData\Local\Arduino15\packages -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -tools C:\Users\Lavandier\AppData\Local\Arduino15\packages -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries C:\Users\Lavandier\Documents\Arduino\libraries -fqbn=arduino:avr:mega:cpu=atmega2560 -ide-version=10805 -build-path C:\Users\LAVAND~1\AppData\Local\Temp\arduino_build_263661 -warnings=all -build-cache C:\Users\LAVAND~1\AppData\Local\Temp\arduino_cache_142444 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.arduinoOTA.path=C:\Users\Lavandier\AppData\Local\Arduino15\packages\arduino\tools\arduinoOTA\1.3.0 -prefs=runtime.tools.avrdude.path=C:\Users\Lavandier\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17 -prefs=runtime.tools.avr-gcc.path=C:\Users\Lavandier\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino5 -verbose C:\Users\Lavandier\Downloads\tank\Controller\Controller.ino
Using board 'mega' from platform in folder: C:\Users\Lavandier\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.1
Using core 'arduino' from platform in folder: C:\Users\Lavandier\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.1
Detecting libraries used...
"C:\Users\Lavandier\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino5/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO=10805 -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR "-IC:\Users\Lavandier\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.1\cores\arduino" "-IC:\Users\Lavandier\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.1\variants\mega" "C:\Users\LAVAND~1\AppData\Local\Temp\arduino_build_263661\sketch\Controller.ino.cpp" -o "nul"
"C:\Users\Lavandier\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino5/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO=10805 -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR "-IC:\Users\Lavandier\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.1\cores\arduino" "-IC:\Users\Lavandier\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.1\variants\mega" "-IC:\Users\Lavandier\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.1\libraries\SPI\src" "C:\Users\LAVAND~1\AppData\Local\Temp\arduino_build_263661\sketch\Controller.ino.cpp" -o "nul"
"C:\Users\Lavandier\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino5/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO=10805 -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR "-IC:\Users\Lavandier\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.1\cores\arduino" "-IC:\Users\Lavandier\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.1\variants\mega" "-IC:\Users\Lavandier\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.1\libraries\SPI\src" "C:\Users\LAVAND~1\AppData\Local\Temp\arduino_build_263661\sketch\Controller.ino.cpp" -o "C:\Users\LAVAND~1\AppData\Local\Temp\arduino_build_263661\preproc\ctags_target_for_gcc_minus_e.cpp"
C:\Users\Lavandier\Downloads\tank\Controller\Controller.ino:9:10: fatal error: RF24.h: No such file or directory

#include "RF24.h"

^~~~~~~~

compilation terminated.

Using library SPI at version 1.0 in folder: C:\Users\Lavandier\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.1\libraries\SPI
exit status 1
Error compiling for board Arduino/Genuino Mega or Mega 2560.

C:\Users\Lavandier\Downloads\tank\Controller\Controller.ino:9:10: fatal error: RF24.h: No such file or directory
#include "RF24.h"

You need to install the RF24 library. The library is available in the Library Manager. Go to Library Manager (in the IDE menus, Sketch, Include Libraries, Manage Libraries) and wait for the library manager to load. In the "Filter your search" box enter RF24. Scroll down if necessary and select and install the RF24 library.

Once the library issue is sorted, can you tell us how the radios are connected to the Megas? If you connect to pins 13, 12 and 11 (SPI pins on the Uno) they will not work. The SPI pins are in different places on the Mega. See the SPI reference.

If he goes to Examples then scroll down to Radiohead then to nrf24 is that not the RF24 library installed? When he was doing the examples from there " NRF24_ client and NRF24_server " I think he was using pin 8 and pin 53 ( I may be wrong ) but he did have " hello World " working
he was watching a video from the Dronebot workshop. The sketch that was there was just a little to much, so the sketches for this tank and control was way easyer for him to follow and understand.