#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2); // Change 0x27 if your address is different
const int buzzerPin = 9;
const int speedSensorPin = A0; // Analog pin for speed sensor
const int speedLimit = 100; // Set speed limit (adjust based on your needs)
void setup() {
pinMode(buzzerPin, OUTPUT);
lcd.begin();
lcd.backlight();
lcd.setCursor(0, 0);
lcd.print("Speed: ");
}
void loop() {
int sensorValue = analogRead(speedSensorPin);
int speed = map(sensorValue, 0, 1023, 0, 200); // Adjust the range as needed
// Display speed on LCD
lcd.setCursor(7, 0);
lcd.print(speed);
lcd.print(" km/h");
// Check if speed exceeds limit
if (speed > speedLimit) {
digitalWrite(buzzerPin, HIGH); // Turn on buzzer
} else {
digitalWrite(buzzerPin, LOW); // Turn off buzzer
}
delay(500); // Update every half second
}
// put your setup code here, to run once: