Arduino Mini Robot Programming.

Поделиться
HTML-код
  • Опубликовано: 13 сен 2024
  • The robot has been in the garage for a few years. Bits need refitting. You can buy the frame for £30 on EBay and the 4 motors cost about £28 total. The program is in the comments.

Комментарии • 5

  • @nxbid
    @nxbid 3 месяца назад +2

    thats so cool!! i loved this video and sat through the entire thing, thanks for this and keep doing awesome stuff!

  • @kevinmahardika447
    @kevinmahardika447 3 месяца назад +1

    that's so cool dude! If I may know what components must be purchased to make the machine ?

    • @damianbutterworth2434
      @damianbutterworth2434  3 месяца назад

      Hi mate, here is the frame and you need to get the 4 MG995 servo`s separately. I might be using the wrong one on the jaws. This sellers says they are all the same. Perhaps this is why I struggled to get it to grip.
      www.ebay.co.uk/itm/296339248801?itmmeta=01HZBXVZRZA91TWZEB8SM7R5PS&hash=item44ff3216a1:g:biwAAOSwDJRmS~x0&itmprp=enc%3AAQAJAAAA4Ek0fQ0KtRA3kiijkjtUXpgo1O2kNXxTcGfypU59cjDmlxmUTYF114GAk5yR8FqZFXFTKVtJvxvIGuHsMf3zr%2B0XBbu4OiPVRyfGlFnGRMDDHQ5SDLPo2PutoZg00C1XI%2FUhF%2BNRNcjgPJshiZ9YCYPLFLkoyv3nh7EKyy5wq6S3jM3nwmGDHi7LvmxmysY%2BkjPt1K811VI4SUdmw%2BfetcdHFjX5JGbU%2Bnx8vGa5UWubSUtplmTdkcjiG61fO1LAouwH4azz2uyF3neZaLnrnEIGuiKMxXr2wPd%2BsK0Htqjt%7Ctkp%3ABFBM3Pzv_fpj

    • @damianbutterworth2434
      @damianbutterworth2434  3 месяца назад

      the servo`s I used are HJS3315D. The must be 180 degree servo`s. I`m struggling to find one on Ebay on it`s own without brackets. But if the EBay adverts says MG99J they should be the same.

  • @damianbutterworth2434
    @damianbutterworth2434  3 месяца назад

    #include
    int step=0;
    int a=90;
    int b=70;
    int c=75;
    int jaw=1;
    int de=15; // ROBOT SPEED. LOWER IS FASTER.
    int ang=0;
    Servo sa;
    Servo sb;
    Servo sc;
    Servo sd;
    void setup() {
    sa.attach(9);
    sb.attach(10);
    sc.attach(11);
    sd.attach(12);
    }
    void loop() {
    start:
    if(step == 0){
    step=step+1;
    goto home;
    }
    if(step == 1){
    step=step+1;
    ang=20;
    goto pick1;
    }
    if(step == 2){
    step=step+1;
    goto lift;
    }
    if(step == 3){
    step=step+1;
    ang=120;
    goto drop;
    }
    if(step == 4){
    step=step+1;
    goto home;
    }
    if(step == 5){
    step=step+1;
    ang=40;
    goto pick1;
    }
    if(step == 6){
    step=step+1;
    goto lift;
    }
    if(step == 7){
    step=step+1;
    ang=140;
    goto drop;
    }
    if(step == 8){
    step=step+1;
    goto home;
    }
    if(step == 9){
    step=step+1;
    ang=60;
    goto pick1;
    }
    if(step == 10){
    step=step+1;
    goto lift;
    }
    if(step == 11){
    step=step+1;
    ang=160;
    goto drop;
    }
    if(step == 12){
    step=step+1;
    goto home;
    }
    delay(10000); step=0;

    goto start;
    pick1:
    if(jaw == 1){
    sd.write(120); // OPEN JAWS
    delay(1000);
    sd.write(95); // TURN JAWS OFF
    jaw=0;
    }
    if(a = ang+1){a=a-1;}
    if(a != ang){
    sa.write(a);
    delay(de);
    }
    if(a == ang){
    if(b = 46){b=b-1;}
    if(c = 76){c=c-1;}
    sb.write(b);
    sc.write(c);
    delay(de);
    if(b == 45 && c == 75){
    sd.write(80);
    delay(1000);
    jaw=1;
    goto start;
    }
    }
    goto pick1;
    drop:
    if(a = ang+1){a=a-1;}
    if(a != ang){
    sa.write(a);
    delay(de);
    }
    if(a == ang){
    if(b = 46){b=b-1;}
    if(c = 76){c=c-1;}
    sb.write(b);
    sc.write(c);
    delay(de);
    if(b == 45 && c == 75){
    sd.write(120);
    delay(1000);
    jaw=0;
    goto start;
    }
    }
    goto drop;
    home:
    if(jaw == 1){
    sd.write(120); // OPEN JAWS
    delay(1000);
    sd.write(95); // TURN JAWS OFF
    jaw=0;
    }
    if(b = 91){b=b-1;}
    if(c = 91){c=c-1;}
    sb.write(b);
    sc.write(c);
    delay(de);
    if(b == 90 && c == 90){
    goto start;
    }
    goto home;
    lift:
    sd.write(70);
    if(b = 91){b=b-1;}
    if(c = 91){c=c-1;}
    sb.write(b);
    sc.write(c);
    delay(de);
    if(b == 90 && c == 90){
    goto start;
    }
    goto lift;
    }