Added Proximity Sensor code

This commit is contained in:
Muhammad Rameen Farooqui 2025-01-03 19:47:11 +05:30
parent 41e1b18ff7
commit 6a977de2ad

View File

@ -0,0 +1,21 @@
const int Pin=2;
void setup()
{
pinMode(Pin, INPUT);
Serial.begin(9600);
}
void loop()
{
int sensorValue = digitalRead(Pin);
if(sensorValue==LOW)
{
Serial.println("no Object");
delay(500);
}
else
{
Serial.println("Object Detected");
delay(500);
}
}