How to connect 2 one wire sensors

Hi all,

I just connected mi one wire to my grove + electron. All is working fine, but I want to connect another one to measure another part of the truck.

How could I connect and read the two sensors?

See attached my code to help.

Thank’s

Eduard

#include <ThingSpeak.h>
// This #include statement was automatically added by the Particle IDE.
#include <OneWire.h>

#include "DS18.h"
/* Thingspeak */
TCPClient client;
unsigned long myChannelNumber = *******;
const char * myWriteAPIKey = "********";

DS18 sensor(D4);

void setup() {
        
    ThingSpeak.begin(client);    
  Serial.begin(9600);
  // Set up 'power' pins, comment out if not used!
  //pinMode(D4, OUTPUT);
  //pinMode(D5, OUTPUT);
  //digitalWrite(D4, LOW);
  //digitalWrite(D5, HIGH);
delay(1000);
    sensor.read();
Serial.printf("Temperature %.2f C", sensor.celsius());
//Serial.printf("Temperature %.2f C %.2f F ", sensor.celsius(), sensor.fahrenheit());
 Serial.println();
    Particle.publish("temperature", String(sensor.celsius()), PRIVATE);



    //battery level
/*FuelGauge fuel;
float batt;
batt = fuel.getVCell();*/
    // Update the 2 ThingSpeak fields with the new data
//    ThingSpeak.setField(1, (float)device);
    ThingSpeak.setField(2, (float)sensor.celsius());
/*    ThingSpeak.setField(3, (float)humidity);
    ThingSpeak.setField(4, (float)pressure);    
    ThingSpeak.setField(5, (float)batt);*/

    // Write the fields that you've set all at once.
    ThingSpeak.writeFields(myChannelNumber, myWriteAPIKey);

    // Give time for the message to reach ThingSpeak
    delay(5000);

    // Sleep for 15 minutes to save battery
    System.sleep(SLEEP_MODE_DEEP, 2 * 60);






}

void loop() {
    



}

That depends on your used library. DS18.h isn’t one that’s available on the Particle library repository so we don’t know how it’s done in yours.
But you could have search the forum for multiple DS18
https://community.particle.io/search?q=multiple%20ds18

@ScruffR, DS18 is part of the IDE OneWire library.

I see :blush:
I always thought it a bad idea to mix and mingle libraries of different purposes tho’