I connected the DS18B20 sensor as the image shows but i don't know how to display the temperature.Please help me.
What have you tried? Did you write a sketch?
I don't know what to write.
Have you written any sketches (code) at all?
This is what i have written.
void setup()
{
Serial.begin(9600);
}
void loop()
{
Serial.print(analogRead(2));
delay(1000);
}
Please click my link and read, because your way off
Your link didn't help me.
search some more because my link really explains everything....
just search arduino ds18s20
dimitrisst:
Your link didn't help me.
Do you have a question? Why wasn't the link helpful? That library works well, I use it all the time. It comes with examples that should get you barking up the right trees.
I tried the code but the only thing i get from the serial is "No more addresses".
Please post the code you tried.
I hadn't noticed your link.Thank you.This code works well.
#include <OneWire.h>
#include <DallasTemperature.h>
// Data wire is plugged into pin 2 on the Arduino
#define ONE_WIRE_BUS 2
// Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs)
OneWire oneWire(ONE_WIRE_BUS);
// Pass our oneWire reference to Dallas Temperature.
DallasTemperature sensors(&oneWire);
void setup(void)
{
// start serial port
Serial.begin(9600);
Serial.println("Dallas Temperature IC Control Library Demo");
// Start up the library
sensors.begin(); // IC Default 9 bit. If you have troubles consider upping it 12. Ups the delay giving the IC more time to process the temperature measurement
}
void loop(void)
{
// call sensors.requestTemperatures() to issue a global temperature
// request to all devices on the bus
Serial.print("Requesting temperatures...");
sensors.requestTemperatures(); // Send the command to get temperatures
Serial.println("DONE");
Serial.print("Temperature for Device 1 is: ");
Serial.print(sensors.getTempCByIndex(0)); // Why "byIndex"? You can have more than one IC on the same bus. 0 refers to the first IC on the wire
}
Good deal. BTW, nice picture in the original post, what was that made with?
Looks like it was drawn using http://fritzing.org/
well worth a look at, it too is open source and there are loads of additional drawing libraries to download.
s4snow:
Looks like it was drawn using http://fritzing.org/well worth a look at, it too is open source and there are loads of additional drawing libraries to download.
Thanks, I was wondering if it was Fritzing. I'm a couple releases behind, haven't played with it much. Will have to get the current version.