Reading 4 OneWire temperature sensors connected to 4 different dig. inputs

The question is the following:

How would I go reading 4 OneWire temp sensors that I have connected on 4 different digital inputs on my Arduino Uno?

I have already made some modification on the Sample code that comes with the OneWire Library pack but didn't have any luck.

Thanx.

I have already made some modification on the Sample code that comes with the OneWire Library pack but didn't have any luck.

Programming is not a matter of luck. It is a matter of thinking logically and skill in using the capabilities of the chosen language to achieve the desired result.

Two questions: Why do you want 4 buses with one passenger, instead of a bus with 4 passengers?

Where is the code that you tried? What, exactly, did it do? How dis that differ from what you wanted?

OK, so that's more than two questions. Sue me.

And if you really do want to run four buses with one passenger, why would you do it with the OneWire library?

If you are using the DS18B20 sensor you could use this:

http://sheepdogguides.com/arduino/ar3ne1tt.htm

You may save a bit of memory, at the cost of three pins, but you should give some thought as how good an idea this is.

To answer your first very logical question, why using 4 buses instead of 1, there is actually at least one case where you would really need so.

What case is that?

Well consider the case where you publish a product and you want some technicians to insert four temp sensors which are named S1, S2, S3, S4 each one of which transfers data from a different yet specific apparatus. So, in this case you would have to know if the sensor attached in S1 transfers temp data from apparatus 1 and not 2.
If you use onewire, you would have to ask, via an interface, the technician, during the installation of your product, if the sensor he has attached in order to read temp from apparatus 1 is S1 or S2 or …
Considering the fact that technicians (at least in my country) have a lot in their minds you wouldn’t want to rely on his ability to declare in a software that he has just attached S1 and not S3…

With this in mind I would prefer to have separate passengers on each bus thus having 4 instead of 1 bus.

About the code.

It was a mod on the original code that comes with onewire lib installation. I am not posting due to the unfortunate fact that I accidentally delete it but in simple words, my problem was that all my sensors were reading the same exact value as temp.

Any how I will review the link you have sent and see if it fits my case. Thanx.

arduino_mike: The question is the following:

How would I go reading 4 OneWire temp sensors that I have connected on 4 different digital inputs on my Arduino Uno?

I have already made some modification on the Sample code that comes with the OneWire Library pack but didn't have any luck.

Thanx.

Use one instance of the class for each bus?

The link has been a huge help. Thx.