Please help me join 2 Sketches (tried so much ! )( Attached are both sketches )

Hi ! I have another open thread but maybe i did not explain myself correctly. 30 People did read it but no one said something , i guess i did something wrong :slight_smile:

Well … I have 2 perfectly working sketches. I would like to join both of them but with a slight modification of function in the other one.

The first Sketch is a working Data Logger sketch that sends data from a BMP180 Pressure sensor to an Sdcard that is on my Ethernet Shield.
The Second Sketch is the SEND Sketch that is part of an Arduino Example sketch for nrf24L01 where it only transmits “Hello World” to a Arduino nano with another nrf24L01. The receiving sketch i woule like to leave just like it is ( if possible ) because it seems to be working :slight_smile:

What I would like to do is add a nrf24L01 to my Data Logger ( Arduino Nano with EthernetSDCARD Schied and BMP180 ) so that it will not transmit “Hello World” but the Sensor Data to the other Arduino Nano with transceiver so that i can see the Data on my Monitor…

( The reason for the whole thing is : I have a project where the arduino data logger is powered by some 9 volt batteries and it is put into a box and left there for about a month ) the whole thing is Airtight hence the pressure sensor bmp180 ). Basically I am trying to check for leaks using the BMP / ignoring any other info from the sensor such as Temperature)

I am attaching the working log sketch and the sending sketch for the nrf24L01.

I hope i explained myself better , and it would be awesome if someone could help me.
Right now I am on a dual monitor setup and trying to join the two sketches , but no avail :o in sight )


Thanks !


sendsketch.ino (1.16 KB)

Will copy and Paste wont work? You cant join together as both sketches will have loop and setup.

Hi ! Thank you for your reply...

No it does not work like u you said. Because of the looops and such ..

Kind regards Christian

What i meant copy and paste is applying selective copy and paste, may be line by line. As far as i know there is no shortcut to achieve what you wanted.

Thank you Sarouje ,

Thats exactly what I am trying to do .. I am on a dual monitor setup and i am trying to do it line by line , but i cannot get it to work ... I aprogramm assembler and pic but not arduino ... I only know Qbasic :)

schukria !


microwhatt: I am on a dual monitor setup and i am trying to do it line by line , but i cannot get it to work ...

what error you are getting or what issues you are facing?

Hello Sarouje ,

I am failing at just pasting it in the correct positions.

I know Qbasic and thats together with assembler and pic programmin it.

Any help from your side to try to join the 2 would be much apreciated.

I do not want anyone to finnish the work for me but i have been on this problem for many days now.

Sarouje I have many more arduinos... Maybe i can just hook up another arduino nano to the existing hardware so it will read the serial data and transmit everything using NRF24L01 ... If thats easier please let me know ..

Thank you ! Christian

Attached the merged sketch, I cant compile it as I dont have any libraries that you are using. May be that gives you head start.

Please use proper indentation.


Thank you Saroje ! I will try it now !

Kind regards Frank

Hello Saroje !

Can should i get you the librarys ?

The Error message i got was :

C:\Users\DEVICE\Downloads\WWWFINALWWWWORKING\WWWFINALWWWWORKING.ino: In function 'void loop()':

WWWFINALWWWWORKING:118: error: redefinition of 'void loop()'

void loop(void){


WWWFINALWWWWORKING:62: error: 'void loop()' previously defined here

void loop() {


exit status 1 redefinition of 'void loop()'

How many code tabs you can see in your Arduino IDE while compiling this sketch?

Sarouje , may i have your email so that i can give you my Teamviewer login ?

Thanks Christian

please post it in the forum. if not me, some one else can also resolve it.

I see..

What should i do next Sarouje ?

Thanks Christian

just attach a screen shot of your Arduino IDE in which you are compiling the sketch.

i was mistaken ... its not working ... sorry

:slight_smile: Done ! Attached is a pic.
Please feel free to log into my system !

:slight_smile: Thank you !

Use the updated talkToRadio function. Replace the below function with the one in your sketch.

void talkToRadio(){
  String theMessage = "Hello there!";
  int messageSize = theMessage.length();
  for (int i = 0; i < messageSize; i++) {
    int charToSend[1];
    charToSend[0] = theMessage.charAt(i);
//send the 'terminate string' value...  
  msg[0] = 2; 
/*delay sending for a short period of time.  radio.powerDown()/radio.powerupp
//with a delay in between have worked well for this purpose(just using delay seems to
//interrupt the transmission start). However, this method could still be improved
as I still get the first character 'cut-off' sometimes. I have a 'checksum' function
on the receiver to verify the message was successfully sent.

Thank you Sarouje !

It compiled with no errors ... I am now hooking up the NRF24L01 :) I hope I still remember how it goes .. haha

Kind regards Frank

I assume your issue is resolved, please append [Solved] to the beginning of the title.