how to combine these two programs?

#include <OneWire.h>

int DS18S20_Pin = 2; //DS18S20 Signal pin on digital 2

//Temperature chip i/o
OneWire ds(DS18S20_Pin); // on digital pin 2

void setup(void) {
Serial.begin(9600);
}

void loop(void) {
float temperature = getTemp();
Serial.println(temperature);

delay(100); //just here to slow down the output so it is easier to read

}

float getTemp(){
//returns the temperature from one DS18S20 in DEG Celsius

byte data[12];
byte addr[8];

if ( !ds.search(addr)) {
//no more sensors on chain, reset search
ds.reset_search();
return -1000;
}

if ( OneWire::crc8( addr, 7) != addr[7]) {
Serial.println("CRC is not valid!");
return -1000;
}

if ( addr[0] != 0x10 && addr[0] != 0x28) {
Serial.print("Device is not recognized");
return -1000;
}

ds.reset();
ds.select(addr);
ds.write(0x44,1); // start conversion, with parasite power on at the end

byte present = ds.reset();
ds.select(addr);
ds.write(0xBE); // Read Scratchpad

for (int i = 0; i < 9; i++) { // we need 9 bytes
data = ds.read();

  • }*

  • ds.reset_search();*

  • byte MSB = data[1];*

  • byte LSB = data[0];*

  • float tempRead = ((MSB << 8) | LSB); //using two's compliment*

  • float TemperatureSum = tempRead / 16;*

  • return TemperatureSum;*

}
THIS IS MY PROGRAM FOR TEMPERATURE SENSOR.
#include "DFRobot_PH.h"
#include <EEPROM.h>
#define PH_PIN A1
float voltage,phValue,temperature = 25;
DFRobot_PH ph;
void setup()
{

  • Serial.begin(115200); *
  • ph.begin();*
    }
    void loop()
    {
  • static unsigned long timepoint = millis();*
  • if(millis()-timepoint>1000U){ //time interval: 1s*
  • timepoint = millis();*
  • //temperature = readTemperature(); // read your temperature sensor to execute temperature compensation*
    voltage = analogRead(PH_PIN)/1024.0*5000; // read the voltage
  • phValue = ph.readPH(voltage,temperature); // convert voltage to pH with temperature compensation*
  • Serial.print("temperature:");*
  • Serial.print(temperature,1);*
  • Serial.print("^C pH:");*
  • Serial.println(phValue,2);*
  • }*
  • ph.calibration(voltage,temperature); // calibration process by Serail CMD*
    }
    float readTemperature()
    {
  • //add your code here to get the temperature from your temperature sensor*
    }
    AND THIS IS FOR PH SENSOR.
    HOW TO COMBINE THESE TWO PROGRAMS SO THAT SERIAL MONITOR SHOWS BOTH TEMPERATURE AND PH VALUE OF ANY LIQUID?

You first need to read the posts at the top of the forum and the part that tells you how to post sketches and code etc.

HOW TO COMBINE THESE TWO PROGRAMS SO THAT SERIAL MONITOR SHOWS BOTH TEMPERATURE AND PH VALUE OF ANY LIQUID?

The second thing you need to do is STOP SCREAMING. We are not deaf. We are ignoring you.

The third thing you need to do is understand the code that you have. If you do understand the code, creating a new sketch that does both things would be trivial.

...and the fourth thing you have to do is not cross-post.

Duplicate deleted