Exit status 1(Code error please help)

So i am new to the programming world, and i have tried this code on an ESP32.
Please help me find out the issue.

Logs:

/usr/local/bin/arduino-cli compile --fqbn esp32:esp32:esp32doit-devkit1:DebugLevel=none,FlashFreq=80,UploadSpeed=921600 --libraries /home/builder/opt/libraries/latest --build-cache-path /tmp --output-dir /tmp/360209116/build --build-path /tmp/arduino-build-71C2353081A2999227BAF2D15A99D353 /tmp/360209116/thf_feb27a

Using library arduino_esp32_ota_0_1_0 at version 0.1.0 in folder: /home/builder/opt/libraries/arduino_esp32_ota_0_1_0

Using library Update at version 2.0.0 in folder: /home/builder/.arduino15/packages/esp32/hardware/esp32/2.0.5/libraries/Update

/tmp/360209116/thf_feb27a/thf_feb27a.ino:71:23: error: expected unqualified-id before '{' token

void onThiefChange(); {

^

Error during build: exit status 1


Code:

/* 
  Sketch generated by the Arduino IoT Cloud Thing "Untitled"
  https://create.arduino.cc/cloud/things/a36c8308-f2b4-49ee-9648-94cf09101fc1 

  Arduino IoT Cloud Variables description

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

  bool thief;

  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"

#include<Servo.h>
Servo s;

void setup() {
  // Initialize serial and wait for port to open:
  Serial.begin(9600);
  // 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(2,OUTPUT);  //RED & BUZ
  pinMode(5,OUTPUT);  //GREEN LED
  pinMode(4,INPUT);    //IR SENSOR
  s.attach(19);
  
}

void loop() {
  ArduinoCloud.update();
  // Your code here 
  thief=digitalRead(4);
  if(thief==0){
    digitalWrite(5,HIGH);
    digitalWrite(2,LOW);

  }
  if (thief==1)
  {
    digitalWrite(5,LOW);
    digitalWrite(2,HIGH);
  
  }
  if (thief==0) {
    s.write(0);
  }
  if (thief==1) {
    s.write(180);
  }
}
void onThiefChange(); {
}

Please help...

Check compiler messages first.

Enable "Compiler Warnings" to ALL in the preferences.


This is all that comes.. in the preferences tab

Do you think this might be trying to tell you something?

Also, please edit your original post and add ‘code tags’ around the program text.
There are sticky posts that can help you get the most from the forum if you read and follow them.

It’s too hard to read your code without it being properly formatted - there’s help for that too.

How can i do so without making everysingle line a code manually? is there a way?

Also thanks for the tip, i will make sure to read them!

please use the little pencil below your post to edit your post, select the code part and press the </> icon in the tool bar to mark it as code. Then save the post

It’s barely readable as it stands. (also make sure you indented the code in the IDE before copying, that’s done by pressing ctrlT on a PC or cmdT on a Mac)


Remove the semi colon you have before the {

Thanks!

Someone put a ';' in the middle of a function declaration.

Works, Thanks!!!

That was the point made here

Or a bit more precisely here

You need to practice a bit decrypting the compiler’s messages

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