a function-definition is not allowed here / expected '}' at end of input
- Arduino C++
- ESP32
- ESP8266
You may see
Why it happens
- A
}is missing after anif,foror function, or there's one too many.
How to fix it
- Press Ctrl+T in the Arduino IDE to line the code up. The place where the indent looks wrong is where the bracket is missing.
- Click next to a
{: the IDE marks its partner. - Add the missing
}, or delete the extra one.
It worked if: After Ctrl+T, void setup() and void loop() both start at the left edge.
Related errors
Tutorials where it can happen
- 16x2 LCD with Arduino: With and Without I2C
- 4-Digit 7-Segment Display with Arduino
- 8x8 LED Matrix with Arduino (No Driver IC)
- Air Quality and HVAC Control with Arduino, DHT11 and MQ-135
- Air Quality Monitor with Arduino, MQ-135 and LCD
- Alcohol Sensor MQ-3 with Arduino and LCD
139 more
- Aquarium Water Quality Monitor with Arduino
- Arduino Board - Pins Explained
- Arduino Breathalyzer with MQ-3 Alcohol Sensor and LCD
- Arduino Data Types and Variables, Simplified
- Arduino Functions: Write Your Own (Beginner Guide)
- Arduino Greenhouse: Temperature and Humidity Control with LCD
- Arduino LED Blink: the Simplest First Circuit
- Arduino Loops Explained: for and while
- Arduino Setup and Installation
- Arduino Sketch Structure: setup() and loop() Explained
- Automated Plant Watering System with LCD Feedback
- Automatic Blinds Control Based On Light Intensity
- Automatic LED Light with Arduino and LDR
- Automatic Pet Feeder with Arduino and Servo
- Automatic Plant Grow Light with Arduino and Relay
- Bluetooth Controlled Servo Motor using Arduino for Kids
- Building a Knock Sensor-Based Doorbell with LCD Display Using Arduino
- Building a Motion Detection System Using ESP32 and ESP-NOW
- Building a Rainfall Measurement and LCD Display with Arduino
- Building a Smart Plant Watering System with Soil Moisture Sensor
- Building a Sound-Activated Alarm System with LCD Display
- Building a Sound-Activated Music Player with LCD Display
- Building a Vibration Sensor with LCD Feedback
- Building an Automated Plant Watering System using ESP32
- Building an Intruder Detection System with LCD and Alarm using Arduino
- Building Electronics Dice with LCD Display
- Capacitive Touch Sensor-Based Home Automation System with LCD Display
- CO Sensor-Based Ventilation Control System with LCD Output
- Coin-Operated Vending Machine with LCD Feedback
- Color Detection and Sorting System with TCS34725
- Colour Picker RGB LED with Arduino
- Creating a Touchless Hand Sanitizer Dispenser with LCD Display
- DHT11 Temperature and Humidity Sensor with Arduino
- Digital Input and Output with the ESP32
- Digital Inputs and Digital Outputs on the NodeMCU ESP8266
- Distance Measurement and Stepper Motor Control with LCD Output
- DIY Heart Rate Monitor with Pulse Sensor and LCD Display
- ESP32 / ESP8266 - Realtime Database with Firebase
- ESP32 Async Web Server Code
- ESP32 BLE Server and Client with Arduino IDE
- ESP32 DHT11 Web Server: Show Temperature and Humidity
- ESP32 PIR Motion Sensor with Interrupts and Timers
- ESP32 PWM with Arduino IDE: LED Brightness Control
- ESP32 Web Server: Control LED Brightness with a Slider
- ESP32/ESP8266 Data Logging to Firebase with Login
- ESP8266 NodeMCU Relay: Control AC Appliances
- Fade and Blink an LED with Arduino (Code Explained)
- Fire Alarm with Arduino and KY-026 Flame Sensor
- Gas Leakage Detection and Solenoid Valve Control with Arduino
- Gas Sensor-Based Air Freshener System with LCD Display
- Gas Sensor-Based Garage Ventilation Control with LCD Display
- Gas Sensor-Based Smart Gas Meter with LCD Display
- Gesture-Controlled Light with Arduino and Ultrasonic Sensor
- Getting Started with ESP8266 WiFi Transceiver
- Guide to Using SSD1306 Display with Arduino
- Hall Effect Sensor with Arduino: Measure Magnetic Field
- HC-SR04 Ultrasonic Sensor with Arduino Uno
- Heart Rate-Based Fitness Tracker with LCD Feedback
- Home Energy Monitor with Arduino
- Home Hydroponics System with Arduino
- Home Security Alarm with Arduino and PIR Sensor
- Home Security System with Motion Detection and LCD Feedback
- How to Fix HC-05 Upload Errors with SoftwareSerial
- How to Make a Smart Energy Meter with Arduino and LCD
- How to make an ESP32 Web Server?
- How to make an ESP8266 Web Server?
- How to Read Analog Signals with the ESP32?
- How to upload your first Code to ESP32 ?
- How to use Bluetooth on the ESP32 ?
- How to use the BLE on the ESP32?
- Human Presence Detection and Lighting Control with LCD Output
- Interfacing ESP32 with 16x2 LCD Displays
- LDR Light Meter with Arduino and LCD
- LED Bar Graph with Arduino
- Light Sensitive Blinds Control System with LCD Output
- Light-Sensitive Motorized Blinds with Arduino and LCD
- Light-Sensitive Plant Growth System with LCD Display
- Line Following Robot with LCD Display
- Liquid Level Detection and Pump Control
- LM35 Temperature Sensor with Arduino
- Log DHT11 Data to Firebase Realtime Database: the Code
- Mini Weather Station with Arduino, DHT11 and 16x2 LCD
- Motion-Activated Security Camera with LCD Feedback
- Motor Speed Control Based on Temperature with LCD Output
- MQ-2 Gas Sensor Arduino Code with I2C LCD
- Object Detection and Sorting System Using IR Sensors with LCD Feedback
- Object Tracking and Following System with LCD Feedback
- Obstacle Avoiding Robot Car with Arduino and LCD
- Obstacle-Avoiding Robot Arm with Arduino and LCD
- pH Level Monitoring and LCD Output with Arduino
- PIR Motion Sensor Alarm with Arduino (HC-SR501 and Buzzer)
- Plant Monitoring System with Arduino: Soil Moisture and DHT22
- Pool Water Quality Monitor with Arduino and pH Sensor
- Programming Environment for ESP32
- Pulse Width Modulation (PWM) with the ESP32
- Pulse Width Modulation with NodeMCU ESP8266
- Put Your Web Page on a Real ESP32
- Rain Sensor with Arduino
- Raindrop Detection and Automatic Wiper Control with LCD Output
- Rainwater Harvesting and Recharge: a Project for Kids
- Reading Analog Input with Arduino
- Reading RFID Tags with RC522 and Arduino
- Real-Time Power Usage Monitor with Arduino
- RFID Access Control with Arduino and LCD
- Send Emails with ESP8266 NodeMCU
- Smart Blinds Control Based on Weather Conditions with LCD Feedback
- Smart Mailbox with Arduino, Ultrasonic Sensor and Servo
- Smart Mirror with Arduino and LCD
- Smart Pet Door with Arduino, Ultrasonic Sensor and Servo
- Smart Plant Pot with ESP32 (IoT)
- Smart Traffic Light System with Arduino
- Smart Trash Can with Arduino: Lid Opens by Itself
- Smoke Detection and Exhaust Fan Control with LCD Display
- Smoke Detection and Fire Sprinkler Control with LCD Display
- Soil Moisture Monitoring and Irrigation System with Arduino Uno
- Soil Moisture Sensor for Farming with Arduino
- Soil Moisture-Based Plant Watering System with LCD Feedback
- Soil pH Level Monitoring and LCD Output
- Solar Power Monitor with Arduino and LCD
- Sound Level Meter with Arduino and LCD
- Sound-Activated LED Light Control with LCD Display
- SSD1306 0.96 inch OLED Display with Arduino (I2C)
- Task Automation with Simple Timer using the ESP32
- Temperature-Controlled Fan with Arduino and LM35
- Ultrasonic Parking Sensor with LCD Display using Arduino
- Ultrasonic Sensor and Servo Motor with Arduino Uno
- Using a Push Button in a Circuit
- UV Light Intensity Measurement and LCD Output
- Vehicle Parking Space Occupancy Detection with LCD Feedback
- Vehicle Speed Measurement and LCD Output Using Arduino
- Water Flow Measurement and Control with LCD using an Arduino
- Water Level Monitoring and Fish Tank Pump Control with Arduino
- Water Level Monitoring and Pump Control System with Arduino
- Water Level Monitoring and Solar Water Heater Control
- Water Quality Monitor with Arduino: pH and Turbidity
- Water Turbidity Measurement and LCD Output
- What is a Web Socket Server?
- What is Arduino? Arduino Uno Basics Explained
- What is ESP32 development Board?
Seen in a real run (some lines are close variants of it). Produced with Arduino CLI 1.5.1 and Arduino AVR core 1.8.8 (the same compiler the Arduino IDE uses).
Didn't help? Search another error or ask us.

