Modifying this multiple sensors onewire sketch :http://www.arduino.cc/playground/Learning/OneWireI would like to log 4 sensors (later write to SD card and send to the web).The best would be for the logfile later the lines look like :"temp1,temp2,temp3,temp4,date,time" - date and time will be here later if this code will be fine.

// a little sprintf help: //%% prints a single % (percent sign). //%c prints a single character with the given ASCII number (66 is printed as B, for example). //%s prints a given string //%d a signed integer in decimal //%u an unsigned (can't be negative) integer in decimal //%o an unsigned integer in octal //%x an unsigned integer in hexadecimal //%e a floating point number in scientific notation //%f a floating point number in fixed decimal notation //%g same as %e or %f, whichever printf thinks is best. //%X is the same as %x, except it uses upper-case letters //%E like %e, but with an upper-case 'E' //%G same as %E when scientific notation is used for the value. //%p a pointer; it outputs Perl's value address in hexadecimal. //%n an odd little bugger that *stores* (in the variable given for the position) the number of characters output so far.

it seems the sprintf() is ok, but the code is not...it only gets one tempareture, and no more...but it should realise multiple ds sensors...

You need to post your code. All of it.

If the loop is being executed the correct number of times, but the temp is not being obtained correctly, there should be 0s in the buffer. If there are no 0s in the buffer, the loop is not executing the correct number of times. You can use Serial.print() to debug you know.

I have to think through the whole project...At the end I would like log to SD card and send data to the web ( thingspeak, cosm...whatever...).I tried a lot of things, but did not manage to work the whole stuff.So I started from the begining...I do not want to hardcode the sensor addresses, and do not wnt to set just one type. That's why I started before with Dallastemperature library and Onewire.Using now Arduino 1.0.2. + The latest Onewire library + latest Dallas Temp. lib. (http://milesburton.com/Main_Page?title=Dallas_Temperature_Control_LibraryJust for a full information: I have mega2560 board with wiznet shield ( what has sd card module, onewire, Realtime clock, and a ds1820 sensor on the shield). Beside these I have at this moment two DS18B20 sensor.Example sketch for multiple ds18 temp sensors is not the best, because that is not good for minus degrees...This code handles the ds18 family and working with minus degrees too:

// search for devices on the bus and assign based on an index. ideally, // you would do this to initially discover addresses on the bus and then // use those addresses and manually assign them (see above) once you know // the devices on your bus (and assuming they don't change). // // method 1: by index // if (!sensors.getAddress(insideThermometer, 0)) Serial.println("Unable to find address for Device 0"); // if (!sensors.getAddress(outsideThermometer, 1)) Serial.println("Unable to find address for Device 1");

// method 2: search() // search() looks for the next device. Returns 1 if a new address has been // returned. A zero might mean that the bus is shorted, there are no devices, // or you have already retrieved all of them. It might be a good idea to // check the CRC to make sure you didn't get garbage. The order is // deterministic. You will always get the same devices in the same order // // Must be called before search() oneWire.reset_search(); // assigns the first address found to insideThermometer if (!oneWire.search(insideThermometer)) Serial.println("Unable to find address for insideThermometer"); // assigns the seconds address found to outsideThermometer if (!oneWire.search(outsideThermometer)) Serial.println("Unable to find address for outsideThermometer");

// show the addresses we found on the bus Serial.print("Device 0 Address: "); printAddress(insideThermometer); Serial.println();

I have to think through the whole project...At the end I would like log to SD card and send data to the web ( thingspeak, cosm...whatever...).

I can't say much about the code - I don't know anything about that sprintf stuff, which I assume is the sole cause of your grief, but I would point out that checking out that the sensors are kosher, or should even be connected, every time the loop goes round is surely absurd. All this is doing is taking up space and giving you something more to worry about.

If I understand the philosophy of your intent correctly, I believe you might need to rethink the role of the SD card. You don't need it to send data to cosm, indeed I don't think you can send a file to cosm. I guess you could incrementally read data off the card and send that to cosm but that would serve little purpose other than prove that whoever snuck in under cover of darkness and stuck a bogus probe on your system, didn't steal the SD on the way out.

In short, the SD card is redundant as far as cosm is concerned. This is because it is intended to work in real time - more or less. I imagine thingspeak is the same, but I haven't followed up on your comment about that. You will see the in my cosm feed code, which we have discussed before, that the SD doesn't get a mention.

This doesn't mean the SD is redundant for the likes of you and I. I was recording to SD before cosm and will be adding that section into the cosm feed sketch soon. This is for backup.

All of the above equally applies if you are logging locally using the the likes of PLX. You don't actually need the SD, or a clock. They are just for backup, and you should be able to prove up your project without either of them.

Paul,yes it is producing correct output(at least as it seems on the serial monitor).degrees below zero is ok and different ds sensors are ok too to handle.Nick,Exactly I would use sd for only backup. In case if something wrong with the internet connection.It is good to have a backup.Thanks for the advices!I know I will be back with the results of each step.

oneWire.reset_search(); if (!oneWire.search(Thermometer1)) Serial.println(F("Unable to find address for Thermometer1")); if (!oneWire.search(Thermometer2)) Serial.println(F("Unable to find address for Thermometer2"));

// show the addresses we found on the bus Serial.print(F("Device 0 Address: ")); printAddress(Thermometer1); Serial.println();