Help Needed with errors

// PZEM004Tv30 - Version: Latest
#include <PZEM004Tv30.h>

// SoftwareSerial for esp8266 - Version: Latest
#include <SoftwareSerial.h>

/*
  Sketch generated by the Arduino IoT Cloud Thing "Untitled"
  https://create.arduino.cc/cloud/things/25edb861-7687-47c1-b95d-4c5241b4e94a

  Arduino IoT Cloud Variables description

  The following variables are automatically generated and updated when changes are made to the Thing

  float pzem_sensor1;
  float pzem_sensor2;
  float pzem_sensor3;
  float pzem_sensor4;
  CloudLight relay;

  Variables which are marked as READ/WRITE in the Cloud Thing will also have functions
  which are called when their values are changed from the Dashboard.
  These functions are generated with the Thing and added at the end of this sketch.
*/

#include "thingProperties.h"

const int main_relay = D1;

const int relay1 = D3;
const int relay2 = D2;

PZEM004Tv30 pzem1(D5, D6, 0x07);// (RX,TX)connect to TX,RX of PZEM
PZEM004Tv30 pzem2(D5, D6, 0x02);
PZEM004Tv30 pzem3(D5, D6, 0x03);
PZEM004Tv30 pzem4(D5, D6, 0x04); // (RX,TX) connect to TX,RX of PZEM
PZEM004Tv30 pzem5(D5, D6, 0x05);
PZEM004Tv30 pzem6(D5, D6, 0x06);
SoftwareSerial SIM900(D7, D8);


void setup() {
  // Initialize serial and wait for port to open:
  Serial.begin(115200);
  // This delay gives the chance to wait for a Serial Monitor without blocking if none is found
  delay(1500);

  // Defined in thingProperties.h
  initProperties();


  // Connect to Arduino IoT Cloud
  ArduinoCloud.begin(ArduinoIoTPreferredConnection);

  /*
     The following function allows you to obtain more information
     related to the state of network and IoT Cloud connection and errors
     the higher number the more granular information you’ll get.
     The default is 0 (only errors).
     Maximum is 4
  */
  setDebugMessageLevel(2);
  ArduinoCloud.printDebugInfo();

  pinMode(relay1, OUTPUT); //star relay
  pinMode(relay2, OUTPUT);// delta relay
  pinMode(main_relay, OUTPUT);
}

void loop() {
  ArduinoCloud.update();
  // Your code here


}


/*
  Since Relay is READ_WRITE variable, onRelayChange() is
  executed every time a new value is received from IoT Cloud.
*/



void onRelayChange()  {
  // Add your code here to act upon Relay change
  if (relay == 1) {
    digitalWrite(main_relay, HIGH);
  }
  else {
    digitalWrite(main_relay, LOW);
  }

  digitalWrite(relay1, LOW);

  float voltage1 = pzem1.voltage();
  Serial.println("the voltage from pzem1 is ");
  Serial.println(voltage1);
  pzem_sensor1 = voltage1;



  float voltage2 = pzem2.voltage();
  Serial.println("the voltage from pzem2 is ");
  Serial.println(voltage2);
  pzem_sensor2 = voltage2;

  float voltage3 = pzem3.voltage();
  Serial.println("the voltage from pzem3 is ");
  Serial.println(voltage3);
  pzem_sensor3 = voltage3;

  delay(5000);

  digitalWrite(relay1, HIGH);
  digitalWrite(relay2, LOW);

  float voltage4 = pzem4.voltage();
  Serial.println("the voltage from pzem4 is ");
  Serial.println(voltage4);
  pzem_sensor4 = voltage4;

  float voltage5 = pzem5.voltage();
  Serial.println("the voltage from pzem5 is ");
  Serial.println(voltage5);
  //pzem_sensor5 = voltage5;

  float voltage6 = pzem6.voltage();
  Serial.println("the voltage from pzem6 is ");
  Serial.println(voltage6);
  //pzem_sensor6 = voltage6;


  if (voltage4 < 90 && voltage5 < 90 && voltage6 < 90)
  {
    digitalWrite(relay2, HIGH);
    delay(500);
    sendSMS1();

  }


  void sendSMS1() {
    // AT command to set SIM900 to SMS mode
    SIM900.print("AT+CMGF=1\r");
    delay(100);

    // REPLACE THE X's WITH THE RECIPIENT'S MOBILE NUMBER
    // USE INTERNATIONAL FORMAT CODE FOR MOBILE NUMBERS
    SIM900.println("AT+CMGS=\"+XXXXXXXXXXXX\"");
    delay(100);

    // REPLACE WITH YOUR OWN SMS MESSAGE CONTENT
    SIM900.println("Message example from Arduino Uno.");
    delay(100);

    // End AT command with a ^Z, ASCII code 26
    SIM900.println((char)26);
    delay(100);
    SIM900.println();
    // Give module time to send SMS
    delay(5000);
  }




Hi Guys can u help me with the problem stated above i cant figure it out ....please and thank you.....ps first time using the arduino iot cloud

You need to close your { with an }

Look up scope and look up the syntax of a function

Void myFunction (){
My function code
}

Welcome to the forum and well done for using code tags. Do the same with the error report instead of a screenshot

Check again

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