Arduino Magix [verified] Jun 2026

Using an HC-SR04 ultrasonic sensor, you can measure distance. Combined with a Servo motor sweeping back and forth, you create a radar screen on your PC that maps out the room without using eyes—like a bat’s echolocation.

void loop() digitalWrite(led, HIGH); delay(1000); digitalWrite(led, LOW); delay(1000); arduino magix

Once the environment is ready, you can test your setup with a simple sketch that blinks the built‑in LED. The on‑board LED is connected to pin 1 (also defined as LED_BUILTIN ). Simply upload the following code and watch it come to life: Using an HC-SR04 ultrasonic sensor, you can measure distance