Question
#include LiquidCrystal lcd(12, 11, 5, 4, 3, 2); float sensorValue1 = 0; float sensorValue2 = 0; float voltageValue = 0; float currentValue = 0; float
#include
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
float sensorValue1 = 0;
float sensorValue2 = 0;
float voltageValue = 0;
float currentValue = 0;
float Power_now = 0, Power_anc=0, Current_anc =0,Voltage_anc=0, deltaI=0, deltaV=0 ;
float delta = 1.4;
float pwm = 128;
void setup()
{
pinMode(6, OUTPUT);
lcd.begin(16, 2);
}
void loop()
{
sensorValue1 = analogRead(A0);
sensorValue2 = analogRead(A1);
voltageValue= (sensorValue1 * 5.0 /1023.0) *5;
currentValue= (sensorValue2 * 5.0 /1023.0);
lcd.setCursor(0, 0);
Power_now = voltageValue * currentValue;
lcd.print("Ppv=");
lcd.print(Power_now);
lcd.print("W");
lcd.setCursor(0, 1);
lcd.print("V=");
lcd.print(voltageValue);
lcd.print("V I=");
lcd.print(currentValue);
lcd.print("A");
deltaI= currentValue-Current_anc;
deltaV= voltageValue-Voltage_anc;
if(deltaV==0)
{ if(deltaI==0)
{// nothing to do
}
else
{ if(deltaI>0)
pwm=pwm-delta;
else
pwm=pwm+delta;
}
}
else
{ if((voltageValue*deltaI)+(currentValue*deltaV)==0)
{// nothing to do
}
else
{ if((deltaI/deltaV)+(currentValue/voltageValue)>0)
pwm=pwm-delta;
else
pwm=pwm+delta;
}
}
Voltage_anc= voltageValue;
Current_anc= currentValue;
Power_anc=Power_now;
if(pwm > 240)
pwm=240;
if (pwm
pwm=15;
analogWrite(6, pwm);
}
the above is arduino code but it is showing errors to me. plz fix the errors. below is screenshot for error
DE 2.0.0-beta. Help X Arduino Uno sketch_mari 4a ino 75 else { if((deltal/deltav)+(currentvalue/voltagevalue) >e) 78 79 pump-delta; else Pump+delta; 81 82 83 } 85 86 87 89 Voltage_anc- voltageValue; Current_anc- currentValue; Power_anc Power_now; if(pum > 240) pum=248; if (puni e) 78 79 pump-delta; else Pump+delta; 81 82 83 } 85 86 87 89 Voltage_anc- voltageValue; Current_anc- currentValue; Power_anc Power_now; if(pum > 240) pum=248; if (puni
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started