write arduino code for ultrasonic sensor and led
//Declare variables int ledPin = 13; int sensorPin = 0; void setup() { Serial.begin(9600); pinMode(ledPin, OUTPUT); } void loop() { int val = analogRead(sensorPin); if(val > 500){ digitalWrite(ledPin, HIGH); }else{ digitalWrite(ledPin, LOW); } Serial.println(val); }