Color sensor+temperature sensor wireless wont work

Hello everyone.

I'm trying to send the data of a BMP280 temp sensor and a TCS230 color sensor wirelessly to another arduino so I can read the data on the serial monitor. The problem I now have is that i'm only getting data when I turn off the arduino. I think that's the data that was stuck in the buffer of the radio module. I'm using an APC220 as radio module.

This is my code:

#include <SoftwareSerial.h>
#include <Wire.h>
#include <SPI.h>
#include <Adafruit_BMP280.h>
#include <Adafruit_Sensor.h>
//#include <Adafruit_BMP2800.h>

#define S0 5
#define S1 4
#define S2 1
#define S3 6
#define sensorOut 7
#define BMP_SCK 13
#define BMP_MISO 12
#define BMP_MOSI 9
#define BMP_CS 8

// Stores frequency read by the photodiodes
int redFrequency = 0;
int greenFrequency = 0;
int blueFrequency = 0;

SoftwareSerial mySerial(10,11);//RX, TX
int number = 0;

//Adafruit_BMP280 bmp; // I2C
//Adafruit_BMP280 bmp(BMP_CS); // hardware SPI
Adafruit_BMP280 bmp(BMP_CS, BMP_MOSI, BMP_MISO,  BMP_SCK);

void setup() 
{
    // Setting the outputs
    pinMode(S0, OUTPUT);
    pinMode(S1, OUTPUT);
    pinMode(S2, OUTPUT);
    pinMode(S3, OUTPUT);
  
    // Setting the sensorOut as an input
    pinMode(sensorOut, INPUT);
  
    // Setting frequency scaling to 20%
    digitalWrite(S0,HIGH);
    digitalWrite(S1,LOW);

    mySerial.begin(9600);
    mySerial.println( F("BMP280 test") );
  
    if (!bmp.begin()) 
    {  
        mySerial.println(F("Could not find a valid BMP280 sensor, check wiring!"));
        while (1);
        
    }//if
    
}//setup

void loop() 
{
    static unsigned long
        timeLoop = 0;
    unsigned long
        timeNow;

    timeNow = millis();
    if( (timeNow - timeLoop) <= 1000 )
        return;

    timeLoop = timeNow;
       
    // Setting RED (R) filtered photodiodes to be read
    digitalWrite(S2,LOW);
    digitalWrite(S3,LOW);
  
    // Reading the output frequency
    redFrequency = pulseIn( sensorOut, LOW );
  
    // Printing the RED (R) value
    mySerial.print( F("R = ") ); mySerial.print(redFrequency);
    delay(100);
  
    // Setting GREEN (G) filtered photodiodes to be read
    digitalWrite(S2,HIGH);
    digitalWrite(S3,HIGH);
  
    // Reading the output frequency
    greenFrequency = pulseIn( sensorOut, LOW );
  
    // Printing the GREEN (G) value  
    mySerial.print( F(" G = ") ); mySerial.print(greenFrequency);
    delay(100);
 
    // Setting BLUE (B) filtered photodiodes to be read
    digitalWrite(S2,LOW);
    digitalWrite(S3,HIGH);
  
    // Reading the output frequency
    blueFrequency = pulseIn(sensorOut, LOW);
  
    // Printing the BLUE (B) value 
    mySerial.print( F(" B = ") ); mySerial.println(blueFrequency);

    mySerial.print( F("Temperature = ") ); //Woordje 'temperature' doorgeven
    mySerial.print(bmp.readTemperature()); //gemeten temperatuur doorgeven
    mySerial.println(" *C"); //graden celsius teken erachter zetten
    
    mySerial.print(F("Pressure = ")); //Woordje 'pressure' doorgeven
    mySerial.print(bmp.readPressure()); //gemeten luchtdruk doorgeven
    mySerial.println(" Pa"); //Pascal erachter zetten

    mySerial.print(F("Approx altitude = ")); //Woordje 'Approx altitude' doorgeven
    mySerial.print(bmp.readAltitude(1031.56)); // this should be adjusted to your local forcase
    mySerial.println(" m");
 
    mySerial.println();
    
}//loop

Can anyone help me?

Are you receiving this message: mySerial.println( F("BMP280 test") );?

Paul

Yes i do.

    static unsigned long
        timeLoop = 0;
    unsigned long
        timeNow;

    timeNow = millis();
    if( (timeNow - timeLoop) <= 1000 )
        return;

    timeLoop = timeNow;

That chunk of code can be simplified to:

  delay(1000);