PROGRAM GIVES MISTAKE

hi there, I have a problem with my arduino project. the code gives mistake and I don’t find my mistake please anybody can help me ??
note: this programme is about measuring temprature and lighting leds

This is my programme:

float sicaklik;

float gerilim;

int sicaklikPin=0;

int led_y=4;
int led_s=3;
int led_k=2;

void setup() {
Serial.begin(4800);//9600 saniyede yapılan bit işlemi
//seri haberleşmeye sensörden gelen sicaklik değerini ekrana alır
pinMode(led_y,OUTPUT);
pinMode(led_s,OUTPUT);
pinMode(led_k,OUTPUT);

}

void loop() {
// okuduğumuz analog değerini dijital veriye çevirecez
//bu değer gerilim değeri olacak gerilim de C* ye dönecek

gerilim = analogWrite(sicaklikPin);
gerilim = (gerilim/1023)*5000;
sicaklik=gerilim/10.0;

//5v=5000mv/1023=4.88
//4.88/10=0.48 yaklaşık her 0.5 derecelik değişim algılanır

if(sicaklik<25){
digitalWrite(led_y,HIGH);
digitalWrite(led_s,LOW);
digitalWrite(led_k,LOW);
}

else if(sicaklik>=25 && sicaklik<30){
digitalWrite(led_s,HIGH);
digitalWrite(led_y,LOW);
digitalWrite(led_k,LOW);
}

else if(sicaklik>=30 && sicaklik<40){
digitalWrite(led_k,HIGH);
digitalWrite(led_s,LOW);
digitalWrite(led_y,LOW);
}

else if(sicaklik>=40){
digitalWrite(led_y,HIGH);
digitalWrite(led_k,LOW);
digitalWrite(led_s,LOW);
delay(100);
digitalWrite(led_s,HIGH);
digitalWrite(led_y,LOW);
delay(100);
digitalWrite(led_k,HIGH);
digitalWrite(led_s,LOW);
delay(100);
}

Serial.print("sicaklik değeri: ");
Serial.print(sicaklik);
Serial.println(“derece”);
delay(500);
}

And this is my mistake report:

Arduino:1.6.0 (Windows 8), Kart:“Arduino Uno”

termometre.ino: In function ‘void loop()’:
termometre.ino:24:35: error: too few arguments to function ‘void analogWrite(uint8_t, int)’
In file included from termometre.ino:1:0:
C:\Users\Asus\Downloads\Compressed\arduino-1.6.0\hardware\arduino\avr\cores\arduino/Arduino.h:130:6: note: declared here
void analogWrite(uint8_t,int);

^
An error occurred during the compilation.

The report should contain more data

gerilim = analogWrite(sicaklikPin);

Read the error message again.

error: too few arguments to function 'void analogWrite(uint8_t, int)'

Hint: analogWrite doesn't return a value

Please remember to use code tags when posting code/

so can you advice me what to do about solving my mistake please

Don’t use analogWrite when you mean analogRead

gerilim = analogWrite(sicaklikPin);
gerilim = (gerilim/1023)*5000;
sicaklik=gerilim/10.0;

Also you should divide by 1024, not 1023.

gerilim = analogRead(sicaklikPin);
gerilim = (gerilim/1024)*5000;
sicaklik=gerilim/10.0;

But: int sicaklikPin=0; Zero isn't an analog pin. Doing an analog read or write is not going to work.

This is possible:int sicaklikPin=A0; since "A0" is a macro.

You can analogRead pin 0. A0 to A5 is really put there for doing digital stuff on them.

thank you all, it really helped me :slight_smile: