08-10-2017, 02:27
This line
if (RX_Data[2] < 4) RX_Data[2] = 0;
SolarRad = map(RX_Data[2], 0, 1023, 0, 1400); // Outputs an integer, between 0 and 1400 W/m2
is missing from (Solar_Sensor == 2). Only (Solar_Sensor == 1) has that line in it. Does that matter?
Surrounding code.
#if (Solar_Sensor == 1) // --- WeatherDuino Solar Cell Pyranometer (Solar / UV interface R2= 2700 Ohm)
if (RX_Data[2] < 4) RX_Data[2] = 0;
SolarRad = map(RX_Data[2], 0, 1023, 0, 1400); // Outputs an integer, between 0 and 1400 W/m2
#endif
#if (Solar_Sensor == 2) // Apogee SP-110: Self-Powered Pyranometer (Solar / UV interface R2= 4700 Ohm)
SolarRad = map(RX_Data[2], 0, 1023, 0, 1600); // Using OP - Formula outputs an integer, between 0 and 1750 W/m2
//SolarRad = round(((RX_data[3] * (1100 / 1024.0)) * 5); // Not using OP. Sensor connected directly to ADC input
#endif
#if (Solar_Sensor == 4) // Apogee SQ-110: Sun Calibration Quantum Sensor (unit is µmol m-2 s-1)
SolarRad = round(((RX_data[2] * (1100 / 1024.0)) * 5);
#endif
if (RX_Data[2] < 4) RX_Data[2] = 0;
SolarRad = map(RX_Data[2], 0, 1023, 0, 1400); // Outputs an integer, between 0 and 1400 W/m2
is missing from (Solar_Sensor == 2). Only (Solar_Sensor == 1) has that line in it. Does that matter?
Surrounding code.
#if (Solar_Sensor == 1) // --- WeatherDuino Solar Cell Pyranometer (Solar / UV interface R2= 2700 Ohm)
if (RX_Data[2] < 4) RX_Data[2] = 0;
SolarRad = map(RX_Data[2], 0, 1023, 0, 1400); // Outputs an integer, between 0 and 1400 W/m2
#endif
#if (Solar_Sensor == 2) // Apogee SP-110: Self-Powered Pyranometer (Solar / UV interface R2= 4700 Ohm)
SolarRad = map(RX_Data[2], 0, 1023, 0, 1600); // Using OP - Formula outputs an integer, between 0 and 1750 W/m2
//SolarRad = round(((RX_data[3] * (1100 / 1024.0)) * 5); // Not using OP. Sensor connected directly to ADC input
#endif
#if (Solar_Sensor == 4) // Apogee SQ-110: Sun Calibration Quantum Sensor (unit is µmol m-2 s-1)
SolarRad = round(((RX_data[2] * (1100 / 1024.0)) * 5);
#endif

