Compiling sketch from text

can someone helpme to compile the sketch form this text , i hace tryed severeal times but no succses getting various error messages.
Reagrds.

#include <Adafruit_GFX.h> //Ekran kütüphanelerini ekleme
#include <Adafruit_SSD1306.h>
Adafruit_SSD1306 display;

const int currentSensor = A0;
const int voltageSensor = A1;
float vOUT = 0.0;
float vIN = 0.0;
float R1 = 10000.0;
float R2 = 1980.0;
float Vdata = 0;
float V,I,I1;
float Cdata;
float value;

void setup(){

display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
display.clearDisplay();
display.setTextColor(WHITE);
display.setTextSize(1);
display.display();

}
void loop(){

//float vIN = 0.0;

for(int i = 0; i < 300; i++) // daha kararlı ortalama bir sonuç almak için 300 kez okuma yapma
{
Cdata = Cdata + analogRead(currentSensor);
Vdata = Vdata + analogRead(voltageSensor);
delay(1);
}

Cdata=Cdata/300;
V=(Cdata/1024.0)*5000;
I=((V - 2500)/ 96);

Vdata=Vdata/300;
vOUT = (Vdata * 5.0) / 1024.0;
vIN = (vOUT / (R2/(R1+R2)));

// OLED Ekrana Yazma
display.setTextColor(WHITE);

// Watt hesaplama ve ekrana yazdırma
display.setTextSize(1);
display.setCursor(58,8);
display.print(" Watt");
display.setCursor(0,0);
display.setTextSize(2);
value=(I * vIN);
if (value<0){display.println("0.0");} else {display.println(value);}

// Amper değerini ekrana yazdırma
display.setTextSize(1);
display.setCursor(58,23);
display.print(" Amper");
display.setCursor(0,16);
display.setTextSize(2);
if (I<0) {display.println("0.0");} else {display.println(I);}

// Voltaj değerini ekrana yazsırma
display.setTextSize(1);
display.setCursor(58,39);
display.print(" Volt");
display.setCursor(0,32);
display.setTextSize(2);
display.println(vIN);

display.display();
display.clearDisplay();

// Değerleri sıfırlama
Cdata=0;
I=0;
V=0;
Vdata=0;
vIN=0;
value;
}Use code tags to format code for the forum

Please use code tags when inserting code in the forum

Moreover, even in the form for creating a message this is written:

What do you think the error message means? When I compile your code, I get:

sketch_feb09a.ino: In function 'void loop()':
sketch_feb09a:89:8: error: expected '}' at end of input
value;
        ^
exit status 1
expected '}' at end of input

(Do you observe, and wonder why the content I inserted above has a different background colour, and has additional formatting as well?)
Also, in the IDE, press ctrl-T to apply default formatting. Then, you'll find that the code at the end of loop() is indented two spaces; the IDE is trying to tell you you're missing your final "}".

Is this line part of the original post as in the real code?

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.