Hackster is hosting Hackster Holidays, Ep. 6: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Monday!Stream Hackster Holidays, Ep. 6 on Monday!
circuito.io team
Published © GPL3+

3D-Printed Air Gate for Drones

Move your drone racing skills to the next level with these interactive air gates!

IntermediateFull instructions provided5 hours10,202
3D-Printed Air Gate for Drones

Things used in this project

Hardware components

Ultrasonic Sensor - HC-SR04 (Generic)
Ultrasonic Sensor - HC-SR04 (Generic)
×1
RGB Diffused Common Anode
RGB Diffused Common Anode
×1
Arduino Pro Mini 328 - 5V/16MHz
SparkFun Arduino Pro Mini 328 - 5V/16MHz
×1
9V battery (generic)
9V battery (generic)
×1

Software apps and online services

circuito.io
circuito.io
Arduino IDE
Arduino IDE

Story

Read more

Custom parts and enclosures

Air Gate Body

Air Gate Base

Air Gate for drones

Code

Air gate void loop

Arduino
Replace the void loop () function in the sample code from circuito.io with the code below
void loop() {
  // Read distance measurment from UltraSonic sensor
  int hcsr04Dist = hcsr04.ping_cm();
  delay(10);
  //Serial.println(hcsr04Dist);

  rgbLed.setRGB(255, 0 , 0 );  //Change the values in the brackets to (255,0,0) for pure RED, (0,255,0) for pure GREEN and (0,0,255) for pure BLUE.


  if (hcsr04Dist < 30 && hcsr04Dist > 2)
  {
    rgbLed.setRGB(0, 255, 0);    //Change the values in the brackets to (255,0,0) for pure RED, (0,255,0) for pure GREEN and (0,0,255) for pure BLUE.
    delay(1000);
  }
}

Credits

circuito.io team

circuito.io team

29 projects • 601 followers
Circuito.io is an online platform that generates wiring and code for Arduino projects. Want to know more? Visit http://circuito.io

Comments