License

Public Domain

Tags
Recommend Projects

Smart bin

1 month ago 228
  • Description
  • Documents
  • BOM
  • Attachments
  • Members
  • Comments

Description

The Code



#include  //ultrasonic sensor library
#include  // servo library
Servo myservo;
UltraSonicDistanceSensor distanceSensor(13, 12);  // Initialize sensor that uses digital pins 13 and 12.

void setup () {
    Serial.begin(9600);  // We initialize serial connection so that we could print values from sensor.
      myservo.attach(9); // Servo pin 9
}
 int pos = 0;
 int distanceLimit = 30;

 //modify here in acording with your needs 
  int StartPose = 0; // Servo starts at 0 degrees
  int EndPose = 70; // Open lid at 70 degrees 

void loop () {
    // Every 500 miliseconds, do a measurement using the sensor and print the distance in centimeters.
    int distance = distanceSensor.measureDistanceCm();
    Serial.println(distance);

    if (distance < distanceLimt && distance != -1)    
    {      
    for (pos = 0; pos 

Documents

Sheet_1

BOM

ID Name Designator Footprint Quantity Manufacturer Part Manufacturer Supplier Supplier Part Price LCSC Assembly Mounted BOM_Manufacturer Part BOM_Manufacturer BOM_Supplier Part BOM_Supplier
1 Arduino Mini U1 NONE 1 Arduino Mini
2 ULTRASONIC U2 NONE 1 ULTRASONIC-HC-SR04
3 Servo M1 NONE 1

Attachments

None
Success
The owner does not allow comments in this project now

Comments (0)

goToTop
你现在访问的是EasyEDA海外版,使用建立访问速度更快的国内版 https://lceda.cn(需要重新注册)
如果需要转移工程请在个人中心 - 工程 - 工程高级设置 - 下载工程,下载后在https://lceda.cn/editor 打开保存即可。
有问题联系QQ 3001956291 不再提醒
svg-battery svg-battery-wifi svg-books svg-more svg-paste svg-pencil svg-plant svg-ruler svg-share svg-user svg-logo-cn svg-double-arrow
We use cookies to offer you a better experience. Detailed information on the use of cookies on this website is provided in our Privacy Policy. By using this site, you consent to the use of our cookies.