Unable to transmit data from MQ-7 Sensor via Wi-Fi

Hello again! before i cut into the chase, sorry about my poor English.

I am working on a project where i have one Arduino Uno that has an MQ-7 carbon monoxide gas sensor connected to it and also a NRF24L01+ module to transmit the read values via wifi to another arduino Uno that also has a NRF24L01+ module connected to it. So, the “first” Arduino with the MQ-7 and the Wi-fi module is the “sender” and the other arduino is the “receiver”. The problem is, when i connect everything into place and upload my code, when i try to monitor the serial port nothing appears there, as if there is no communication between the two.

The code i am uploading to the “sender” is this:

#include <SPI.h> 
#include "RF24.h"

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


int sensorPin = A0;  // select the input pin for the CO sensor
// initialize digital pin ledPin as an output 
 int ledPin = 2;
 
struct package
{
  int id=1;
  char  text[100] = "CO Level:";
  public: int sensorValue = 0; // variable to store the value coming from the sensor
};


typedef struct package Package;
Package data;


void setup()
{
  Serial.begin(9600);
  delay(1000);
  myRadio.begin(); 
  myRadio.setChannel(115);
  myRadio.setPALevel(RF24_PA_MAX);
  myRadio.setDataRate( RF24_250KBPS ) ;
  myRadio.openWritingPipe( addresses[0]);
  delay(1000);
 pinMode(ledPin, OUTPUT);   
 
}

void loop()
{
 analogWrite(ledPin, 255);  // "HIGH" state - 5V 
  delay(60000);            // HIGH" state lasts 60 seconds 
 // After heating it's time to go to "LOW" state 
  analogWrite(ledPin, 72);  // "LOW" state - 1.4V 
  delay(90000);            // "LOW" state lasts for 90 seconds 
 // Waiting 90 more seconds 
  digitalWrite(ledPin, HIGH); 
  delay (50); //small delay so that the sensor does not heat too much 
   // Reading Sensor 
 data.sensorValue = analogRead(sensorPin); 
  myRadio.write(&data, sizeof(data));

  Serial.print("\nPackage:");
  Serial.print(data.id);
  Serial.print("\n");
  Serial.println(data.text);
  Serial.println(data.sensorValue);
  data.id = data.id + 1;
  delay(1000);

}

and the code for the receiver is this:

#include <SPI.h>  
#include "RF24.h" 

RF24 myRadio (7, 8); 
struct package
{
  int id=0;
  char  text[100] ="empty";
public: int sensorValue;
};

byte addresses[][6] = {"0"}; 



typedef struct package Package;
Package data;

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

  myRadio.begin(); 
  myRadio.setChannel(115); 
  myRadio.setPALevel(RF24_PA_MAX);
  myRadio.setDataRate( RF24_250KBPS ) ; 
  myRadio.openReadingPipe(1, addresses[0]);
  myRadio.startListening();
}


void loop()  
{

  if ( myRadio.available()) 
  {
    while (myRadio.available())
    {
      myRadio.read( &data, sizeof(data) );
    }
    Serial.print("\nPackage:");
    Serial.print(data.id);
    Serial.print("\n");
    Serial.println(data.text);
    Serial.println(data.sensorValue);
  }

}

The circuitry i have connected for the “sender” is this:

and for the receiver:

So, where am i going wrong? Is there something wrong with my code and/or my connections?

Thanks in advance!

I would suggest getting simple communication going between the two nRF24 boards.
There are a couple of terrific tutorials on this.
Make sure you understand how to do this before continuing.

Is there a way to fix something in the code and use it instead of re-writing from scratch? I hace out a lot of work into this project and i really need to finish it!

gazp:
Is there a way to fix something in the code and use it instead of re-writing from scratch? I hace out a lot of work into this project and i really need to finish it!

The only way to really understand it is to write it yourself.
Copying and pasting code works fine until it doesn't work, and you have no idea what is going on.

Find a decent nRF24L01 tutorial, follow the example code, and make sure you understand every single line before blindly copying it. This way, you know what you need to change/keep when implementing it for your own project.

Pieter

PieterP:
The only way to really understand it is to write it yourself.
Copying and pasting code works fine until it doesn't work, and you have no idea what is going on.

Find a decent nRF24L01 tutorial, follow the example code, and make sure you understand every single line before blindly copying it. This way, you know what you need to change/keep when implementing it for your own project.

Pieter

the code i have quoted is not a copy paste as you suggest. The fact is that for some reason it does not work and i am stuck. What you say really is not fair but thanks for taking the time to answer anyway.

gazp:
the code i have quoted is not a copy paste as you suggest. The fact is that for some reason it does not work and i am stuck. What you say really is not fair but thanks for taking the time to answer anyway.

Not fair? ? ?

It's your project. Not ours.
It doesn't work. YOU fix it.
It is not our problem.
That is the reality.

ieee488:
Not fair? ? ?

It's your project. Not ours.
It doesn't work. YOU fix it.
It is not our problem.
That is the reality.

ok. no offense but i thought i could use the forum to get some help, seems i thought wrong.
All the best to all of you and thanks for the "assistance".

gazp:
ok. no offense but i thought i could use the forum to get some help, seems i thought wrong.
All the best to all of you and thanks for the "assistance".

Just because you didn't get the assistance you wanted, does not make the assistance invalid.
I took my own advice. I did the tutorial first.
But since you want to jump in without a life preserver, you go figure how to swim back to shore.

My point is that you have to understand what your code is doing before you can start debugging. You have to know what variables to check, what breakpoints to add, check smaller parts independently, etc. Once you have that figured out, and you did some troubleshooting and debugging yourself, you can narrow the problem down and ask specific questions on a forum like this.

You can not expect that someone is going to do all that debugging for you (downloading your code, necessary libraries, building the hardware, etc.), that's not how this community works. You have to do some effort yourself before asking "Help, my program doesn't do what I expect it to do, what's wrong?". No one can answer that without spending many hours of their valuable time.

If you have a concrete problem or question, or if you want some general advice, we'll be glad to help you. If you want someone to debug and fix your entire project, you should hire someone.

The only thing that's not fair is that you are asking other people to do all of your work for you.