Enquiries on how to write the code

Hello all!

I am embarking on a project that requires me to build a drone landing pad with 3 different layers of LED using ultrasonic sensor. So the idea of this project is at example 100m, the outer layer LED will light up. After the drone descends to probably estimate 60m, the outer layer LED will be turn off and the centre layer LED will be turn on. Subsequently, as the drone descends to probably about 20m, the centre layer LED will be turn off and the inner LED will be turn on before the drone will officially lands. As this is the first time i am using arduino, i am unsure on how to write the entire coding. I only know i have to write a program with ping and Ifstatementconditional. Any kind souls is able to help me out? Many thanks!!

Junhui

How do you detect a drone at 100, 60 and 20 metres?

Hello my circuit diagram is as attached. The HC-SR04 is somewhat fixed but for the LED, as i say previously there will be 3 layers of LED. So the outer layer is connected with the brown wire, second layer is connected with the blue wire and the inner layer is connected with the orange wire. So i think i have to write a code so that the HC-SR04 ultrasonic sensor will be able to measure the distance of the drone at the respective altitude and light the respectively layer accordingly.

Unfortunately the maximum range of an HC-SR04 is about 4m...and that's detecting something large and solid like a wall. Detecting something small and mobile at 100m is going to need a considerably better range-finding device.

Since most drones these days contain GPS altimeters if you're working with a specific drone can't you get the data from that transmitted to your device? The data exists because that's how "Return to base" works. But if you need it to work with any old drone then all bets are off.

Steve