arduino_mastermind
Published © GPL3+

Smart delivery arm

An arm that can make no-touch deliveries, extremely simple!!!!

BeginnerFull instructions provided372
Smart delivery arm

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
SG90 Micro-servo motor
SG90 Micro-servo motor
×1
Ultrasonic Sensor - HC-SR04 (Generic)
Ultrasonic Sensor - HC-SR04 (Generic)
×1
USB-A to B Cable
USB-A to B Cable
×1
Breadboard (generic)
Breadboard (generic)
×1
LED (generic)
LED (generic)
×1
Male/Female Jumper Wires
Male/Female Jumper Wires
×1
Male/Male Jumper Wires
×1

Software apps and online services

Arduino IDE
Arduino IDE

Hand tools and fabrication machines

Hot glue gun (generic)
Hot glue gun (generic)

Story

Read more

Schematics

ard_gCIIdTwpKS.png

trigpin of ultrasonic on pin 5
echo of ultrasonic on pin 6
servo on pin 9
led on pin 11
respective gnd and 5v connections
i am sorry, i was not able to use fritzing
please see schematics in the code to confirm

Code

servo arm

C/C++
just paste the code in arduino ide
// generated by mBlock5 for <your product>
// codes make you happy

#include <Servo.h>
#include <Arduino.h>
#include <Wire.h>
#include <SoftwareSerial.h>

Servo servo_9;
float getDistance(int trig,int echo){
    pinMode(trig,OUTPUT);
    digitalWrite(trig,LOW);
    delayMicroseconds(2);
    digitalWrite(trig,HIGH);
    delayMicroseconds(10);
    digitalWrite(trig,LOW);
    pinMode(echo, INPUT);
    return pulseIn(echo,HIGH,30000)/58.0;
}

void _delay(float seconds) {
  long endTime = millis() + seconds * 1000;
  while(millis() < endTime) _loop();
}

void setup() {
  servo_9.attach(9);
  pinMode(11,OUTPUT);
  servo_9.write(180);
  while(1) {
      if(getDistance(6,7) > 50){
          digitalWrite(11,0);
          servo_9.write(180);
          _delay(2);
          servo_9.write(0);

      }else{
          digitalWrite(11,1);

      }

      _loop();
  }

}

void _loop() {
}

void loop() {
  _loop();
}

Credits

arduino_mastermind
1 project • 0 followers
Contact

Comments

Please log in or sign up to comment.