I am new to using the device esp32 i want correct code

engjjd
Posts: 1
Joined: Fri Jun 04, 2021 11:11 am

I am new to using the device esp32 i want correct code

Postby engjjd » Fri Jun 04, 2021 11:16 am

hi
I am new to using the device esp32 i want correct code written for Arduino i want convert to esp32 Modula

Code: Select all

int relayPinpv = 23;      // relay for phptovolatic panel 
int relayPinbattery = 22;   // relay for battery 
int relayPingrid2 =01;       // relay for Neighbors grid
int relayPintg = 19;          // relay for tradtional grid
int relayPingen = 23;          // relay for generator
float ppv=600 ; 
float pbattery=600 ; 
float pgrid2 ; 
float vtg ; 
float pt= 500 ;       //load power 500 W 
 
void setup() {
  pinMode(relayPinpv, OUTPUT);
    pinMode(relayPinbattery, OUTPUT);
      pinMode(relayPingrid2, OUTPUT);
        pinMode(relayPintg, OUTPUT);
        pinMode(relayPingen, OUTPUT);
}
 
void loop() {


  if (ppv>= pt) {
  
  digitalWrite(relayPinpv, HIGH);
  digitalWrite(relayPintg, LOW);
  digitalWrite(relayPinbattery, LOW);
  digitalWrite(relayPingrid2, LOW);
}
else if ((ppv<pt)&&((ppv+pbattery)>= pt))
{ 
  digitalWrite(relayPinpv, HIGH);
  digitalWrite(relayPinbattery, HIGH);
  digitalWrite(relayPingrid2, LOW);
  digitalWrite(relayPintg, LOW);
}
else if ((ppv<pt)&&((ppv+pbattery)<pt)&&((ppv+pbattery+pgrid2)>= pt))
{ 
  digitalWrite(relayPinpv, HIGH);
  digitalWrite(relayPinbattery, HIGH);
  digitalWrite(relayPingrid2, HIGH);
  digitalWrite(relayPintg, LOW);
  }
else if (vtg >0) { 
  digitalWrite(relayPintg, HIGH);
  digitalWrite(relayPinpv, LOW);
  digitalWrite(relayPinbattery, LOW);
  digitalWrite(relayPingrid2, LOW);
}
else { 
  digitalWrite(relayPingen, HIGH);
  digitalWrite(relayPintg, LOW);
  digitalWrite(relayPinpv, LOW);
  digitalWrite(relayPinbattery, LOW);
  digitalWrite(relayPingrid2, LOW);
  
}
 
  delay(1000);
}

ESP_Minatel
Posts: 209
Joined: Mon Jan 04, 2021 2:06 pm

Re: I am new to using the device esp32 i want correct code

Postby ESP_Minatel » Fri Jun 04, 2021 3:04 pm

Hi,

What exactly you are looking for?

Who is online

Users browsing this forum: No registered users and 9 guests