can you help me, i don't know what should i do..
Compilation error: expected constructor, destructor, or type conversion before '(' token
This is my code
pinMode(A0, INPUT);
Serial.begin(9600); // Starting Serial Terminal
Myservo.attach(5); // Signal Pin of Servo
pinMode(trigPin, OUTPUT); // Set trig pin as output
pinMode(echoPin, INPUT); // Set echo pin as input
pinMode(trigPin2, OUTPUT); // Set trig pin as output
pinMode(echoPin2, INPUT);
pinMode(12, OUTPUT);
Serial.print(" Distance ");
Serial.print(" Measurement ");
SIM900.begin(9600);
delay(2000);
}
void loop() {
//----------------------------------------Ultrasonic 1, mendeteksi tangan untuk handsanitizer
long duration, cm; // Declaring a variable
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
digitalWrite(trigPin, HIGH);
delayMicroseconds(10); //To keep trig pin high for 10us
digitalWrite(trigPin, LOW);
duration = pulseIn(echoPin, HIGH); //Taking input from echo pin
cm = microsecondsToCentimeters(duration);
Serial.print("Distance:");
Serial.print(cm);
Serial.print("cm");
delay(100);
if (cm >= 10) // Distance should be less than 10cm
{
Myservo.write(0); // Neutral Position of shaft
} else {
Myservo.write(90); // Turn left
}
Serial.print();
delay(100);
//----------------------------------------TMP36, cek suhu untuk buzzer
baselineTemp = 37.5;
celsius = map(((analogRead(A0) - 20) * 3.04), 0, 1023, -40, 125);
Serial.print(celsius);
Serial.print(" C, ");
if (celsius > baselineTemp) {
tone(9, 100, 1000); // Send 100 Hz sound signal
delay(0);
}
//----------------------------------------Ultrasonic 2, cek isi handsanitizer
digitalWrite(trigPin2, LOW);
delayMicroseconds(2);
digitalWrite(trigPin2, HIGH);
delayMicroseconds(10); //To keep the trig pin high for 10us
digitalWrite(trigPin2, LOW);
duration = pulseIn(echoPin2, HIGH); //Taking input from echo pin
cm = microsecondsToCentimeters(duration);
Serial.print("Distance:");
Serial.print(cm);
Serial.print("cm");
delay(100);
if (cm <= 10) // Distance should be less than 10cm
{
SIM900.println("Handsanitizer Habis! Mohon diisi ulang! \n");
}
Serial.println();
delay(0);
}
long microsecondsToCentimeters(long microseconds) {
return microseconds / 29 / 2; // To convert microseconds to centimeters
}