void setup() {
// Seri haberleşme başlat
Serial.begin(9600);
// Sensör başlat
sensor.begin();
}
void loop() {
// Sıcaklık ölçümü başlat
sensor.requestTemperatures();
// Sıcaklık ölçümü sonucunu oku ve seri porta yazdır
float temperature = sensor.getTempCByIndex(0);
Serial.print("Sicaklik: ");
Serial.print(temperature);
Serial.println(" C");
// Bekle
delay(1000);
}
ps:As soon as the upload is complete, the arduino is blinking 4 fast 4 slow and disconnecting from the computer. Any ideas? When I do a quick reset twice, the led turns green and the computer recognizes it again. I installed the example blink, it works.
Usually, a 4.7K ohm 1/4W pull-up resistor is used with DS18B20. I can see that you are using a 5W resistor. Perhaps that is not an issue. But it's better to try the typical circuit. I do not think the problem exists in the code.
i also uploaded example 1wire code. as soon as upload complete, pc lost connection with arduino. some says reduce the resistor i have tried with 2.8k an 3.2k resistor
4.7k is 4.7k and, while a 5W resistor might look a little silly, it is still 4.7k and can't possibly be the cause of your problem. You could try code from a tutorial, Hacktronics foe example, but the problem may simply be slack-arsed wiring. You do seem to be using more than you should need, amd a problem can lie in every joint.
hello tomZ pic is attached:) and i have learned arduino 4fast-4Slow red blinks when MbedOs crashes.
as i said earlier when i upluad the code without connecting ds18b20 sensor; it also crashes.
thanx for your kindly reply:)