Arduino UNO power consumption error

Hell guys I am having trouble solving this error , mby I am just stupid or what but here is the code :

#include <LiquidCrystal.h>

double sensePinV = 220;
double sensePinI = 0;
int timer;
int timerSec1;
int timerSec2;
int timerMin;
double Volts;
double Current;
double Power;
double PowerWh;
LiquidCrystal lcd(12, 11, 10, 5, 4, 3, 2);

void setup(){
  analogReference(DEFAULT);
  lcd.begin(16, 2);
  timer=0;
  Volts=0;
  Current=0;
  Power=0;
  PowerWh=0;
}

void loop() {
  Volts = 220;
}
  
  Current = (((analogRead(sensePinI)) / 212.0) - 2.55 / 0.06666667;
  if(Current < 0){
    Current = 0;
    }
    
  Power = Volts * Current;
  PowerWh = (Power/3600) + PowerWh;

  lcd.setCursor(0,0);
  lcd.print("               ");
  lcd.setCursor(0,0);
  lcd.print(Volts);
  lcd.print("V");

  lcd.setCursor(10,0);
  lcd.print(Current);
  lcd.print("A");

  lcd.setCursor(0,1);
  lcd.print("               ");
  lcd.setCursor(0,1);
  lcd.print(Power);
  lcd.print("W");
  lcd.setCursor(10,1);
  lcd.print(PowerWh);
  lcd.print("Wh");
  delay(1000);
}

And the error i get is : exit status 1 : ‘Current’ does not name a type

Here is your loop function.

void loop() {
  Volts = 220;
}

Everything after this is misplaced code. All code belongs in functions, not spread wherever you feel like.

Are you sure that you posted the code that produces the error that you quote ? I get plenty of errors caused by what Paul points out but not the error that you seem to.

Thanks for the answer , so I get it right by putting all under void loop into the void loop?

so I get it right by putting all under void loop into the void loop?

You need to do that and see whether the result compiles, and, if it does, if it then does what you expect.

Doing so WILL resolve the error you asked about.

nvm idiot me

So guys now all is working but , when I go with experiment I get nothing displayed on lcd display

#include <LiquidCrystal.h>

double sensePinV = 220;
double sensePinIA0 = 0;
int timer;
int timerSec1;
int timerSec2;
int timerMin;
double Volts;
double Current;
double Power;
double PowerWh;
LiquidCrystal lcd(12, 11, 10, 5, 4, 3, 2);

void setup(){
  Serial.begin(9600);
  analogReference(DEFAULT);
  lcd.begin(16, 2);
  timer=0;
  Volts=0;
  Current=0;
  Power=0;
  PowerWh=0;
}

void loop() {
  Volts = 220;
  Current = (((analogRead(sensePinIA0)) / 212.0) - (2.55 / 0.06666667));
  if(Current < 0){
    Current = 0;
    }
    
  Power = Volts * Current;
  PowerWh = (Power/3600) + PowerWh;

  lcd.setCursor(0,0);
    lcd.print(Volts);
    lcd.print(" V ");
    lcd.print(Current);
    lcd.print(" A ");
}

all is working but , when I go with experiment I get nothing displayed on lcd display

So not really working after all. double sensePinIA0 = 0;Why a float for a pin number that will never change anyway so could be const byte ?

Does the LCD work with a simple "Hello World" program ?

Yes the program runs simple Hello World

steskaniarduino: Yes the program runs simple Hello World

So what is the difference between them in the definition and setup of the LCD ? Do you not even see "V" and "A" on the display ? What do you see if you use Serial.print() instead of lcd.print() ?

Your original code was

LiquidCrystal lcd(12, 11, 10, 5, 4, 3, 2);

Your new code is

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

Spot the difference.

 amplitude_current = ((getMaxValue() / 212.0) - (2.55 / 0.06666667));

What are these "magic" numbers all about ?