Robotics EveryDay
Published © GPL3+

Drawing Robot | Arduino Servo Robot | Rangoli Making Robot

This is a drawing/sand art-making robot. It has 2 servo motors controlled by an Arduino Uno prototyping board. It can draw different shapes.

IntermediateFull instructions provided3,736
Drawing Robot | Arduino Servo Robot | Rangoli Making Robot

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
SG90 Micro-servo motor
SG90 Micro-servo motor
×2
Breadboard (generic)
Breadboard (generic)
×1
Jumper wires (generic)
Jumper wires (generic)
×1
USB-A to Mini-USB Cable
USB-A to Mini-USB Cable
×1

Hand tools and fabrication machines

Scissor, Electrician
Scissor, Electrician
Tape, Electrical
Tape, Electrical

Story

Read more

Custom parts and enclosures

Rangoli Making Robot CAD Design

Schematics

Drawing Robot

Code

Rangoli Making Robot Code

Arduino
#include <Servo.h>

Servo m1,m2;

float d,h,l,phi;
float theta1,theta2;
int i,j;

int dly=80;

void setup() {
  m1.attach(11);
  m2.attach(10);
  

}

void go(float x, float y){
  
  l = 8; //length of link, l= 8cm
  
  d = sqrt((x*x)+(y*y)); //distace between origin left and (x,y) point

  phi = atan2(y,x)*180/3.14; // phi, angle between d and x axis  
  
  h = sqrt((l*l)-((d/2)*(d/2))); //height of the triangle
  
  theta1 = atan2(h,(d/2))*180/3.14; // phi 1, angle between d and axis
  
  theta2 = (90 - theta1)*2; // angle between l and l


  theta1+=phi;
  
  if ((theta1>0 && theta2>0) && (theta1<180 && theta2<180)){
    m1.writeMicroseconds((int)((theta1/180)*1500+700));
    m2.writeMicroseconds((int)((theta2/180)*1500+700));
    
  }
  
}

void coverage(){
  for (i=0;i<180;i+=1){
    m1.write(i);  
    delay(25);
  }  

  for (j=10;j<180;j+=1){
    m2.write(j);
    delay(25);
  }
  
  for (i=180;i>0;i-=1){
    m1.write(i);  
    delay(25);
  }  

  
  for (j=180;j>10;j-=1){
    m2.write(j);
    delay(25);
  }
}

void human(){
  int l= 100;
  float x[l]={1.92, 2.33, 2.75, 3.17, 2.25, 1.33, 0.83, 0.5, 0.25, 0.25, 0.33, 0.83, 1.25, 1.75, 2.33, 2.92, 3.5, 3.25, 3.0, 2.83, 2.75, 2.83, 2.92, 3.25, 3.5, 3.92, 4.33, 4.92, 5.33, 5.83, 6.25, 6.5, 6.67, 6.75, 6.75, 6.75, 6.67, 6.5, 6.33, 6.25, 6.67, 7.0, 7.5, 8.0, 8.33, 8.67, 9.0, 9.0, 9.0, 9.0, 8.83, 8.5, 8.0, 7.5, 7.0, 6.5, 6.08, 6.25, 6.42, 6.58, 6.75, 6.92, 7.17, 7.33, 7.5, 7.67, 8.08, 8.42, 8.83, 8.75, 8.67, 8.42, 8.0, 7.42, 6.92, 6.42, 5.92, 5.67, 5.42, 5.17, 4.92, 4.75, 4.5, 4.25, 4.0, 3.67, 3.5, 2.92, 2.25, 1.67, 1.25, 0.92, 0.58, 0.5, 0.5, 0.67, 1.0, 1.42, 1.58, 1.92};
  float y[l]={8.92, 8.33, 7.5, 6.58, 6.67, 6.75, 6.67, 6.33, 5.92, 5.33, 4.83, 4.5, 4.33, 4.25, 4.17, 4.17, 4.17, 3.83, 3.5, 3.08, 2.58, 2.0, 1.5, 1.17, 0.83, 0.5, 0.25, 0.25, 0.42, 0.58, 0.83, 1.25, 1.58, 2.0, 2.42, 2.92, 3.25, 3.58, 3.92, 4.0, 4.25, 4.25, 4.25, 4.42, 4.5, 4.67, 4.92, 5.25, 5.67, 5.92, 6.33, 6.58, 6.67, 6.67, 6.67, 6.5, 6.5, 6.83, 7.17, 7.5, 7.92, 8.25, 8.58, 8.92, 9.25, 9.33, 9.42, 9.58, 9.92, 10.33, 10.83, 11.25, 11.42, 11.42, 11.58, 11.5, 11.25, 11.0, 10.67, 10.42, 10.17, 9.92, 10.0, 10.42, 10.83, 11.0, 11.33, 11.5, 11.5, 11.58, 11.33, 11.08, 10.83, 10.33, 9.92, 9.58, 9.42, 9.5, 9.33, 8.92};
  
  for(i=0;i<l;i+=1){
    go(x[i],y[i]+2);  
    delay(dly);
  }
  
}

void star(){
  int l=99;
  float x[l] = {3.8333, 3.9167, 4.0, 4.1667, 4.25, 4.3333, 4.4167, 4.5, 4.6667, 4.25, 3.9167, 3.5833, 3.25, 2.8333, 2.5833, 2.6667, 2.9167, 3.1667, 3.5, 3.75, 4.0, 4.3333, 4.6667, 4.9167, 5.25, 5.25, 5.4167, 5.5, 5.6667, 5.75, 5.8333, 5.9167, 6.0, 6.1667, 6.1667, 6.25, 6.3333, 6.4167, 6.4167, 6.5, 6.5833, 6.6667, 6.6667, 6.75, 6.8333, 6.8333, 7.0, 7.0833, 7.3333, 7.5, 7.75, 7.9167, 8.0833, 8.25, 8.5, 8.75, 9.0, 9.1667, 9.0833, 8.75, 8.5, 8.25, 8.0, 7.8333, 7.6667, 7.4167, 7.25, 7.3333, 7.4167, 7.5833, 7.5833, 7.6667, 7.75, 7.8333, 7.9167, 8.0833, 8.1667, 8.0, 7.8333, 7.5, 7.1667, 7.0, 6.8333, 6.5, 6.25, 6.0, 5.75, 5.5833, 5.5, 5.1667, 5.0833, 4.8333, 4.6667, 4.5, 4.3333, 4.0833, 3.9167, 3.8333, 3.6667};
  float y[l] = {8.75, 8.4167, 8.0833, 7.75, 7.4167, 7.0833, 6.75, 6.5, 6.1667, 6.0, 5.75, 5.5, 5.25, 5.0833, 4.8333, 4.6667, 4.6667, 4.6667, 4.6667, 4.6667, 4.6667, 4.6667, 4.6667, 4.6667, 4.75, 4.4167, 4.0833, 3.75, 3.5, 3.1667, 2.8333, 2.5833, 2.3333, 2.5, 2.6667, 2.8333, 3.0833, 3.25, 3.4167, 3.5833, 3.75, 4.0, 4.1667, 4.3333, 4.4167, 4.5833, 4.6667, 4.6667, 4.6667, 4.6667, 4.6667, 4.6667, 4.6667, 4.6667, 4.6667, 4.6667, 4.6667, 4.6667, 4.8333, 5.0, 5.1667, 5.3333, 5.5, 5.75, 5.8333, 6.0, 6.1667, 6.4167, 6.5, 6.8333, 7.0833, 7.3333, 7.5, 7.8333, 8.0833, 8.25, 8.5833, 8.3333, 8.1667, 8.0833, 7.9167, 7.6667, 7.5, 7.25, 7.0833, 7.0, 7.0833, 7.25, 7.4167, 7.5833, 7.75, 7.9167, 8.0833, 8.1667, 8.25, 8.4167, 8.5833, 8.75, 8.8333};

  for(i=0;i<l;i+=1){
    go(x[i],y[i]);  
    delay(dly);
  }
}

void hand(){
  int l=55;
  float x[l] ={3.5833, 3.5, 3.75, 4.1667, 4.25, 4.25, 4.5833, 4.5833, 4.5833, 4.5833, 4.9167, 5.25, 5.3333, 5.3333, 5.4167, 5.4167, 5.6667, 5.75, 5.75, 5.6667, 5.9167, 6.25, 6.5833, 6.5833, 6.5833, 6.5833, 6.5833, 6.8333, 6.9167, 7.0, 7.0, 7.25, 7.6667, 7.6667, 7.75, 7.75, 7.75, 7.75, 8.1667, 8.5, 9.0, 9.3333, 9.0, 8.5, 8.0, 7.5, 6.8333, 6.0833, 5.1667, 4.5833, 4.0833, 3.6667, 3.5833, 3.5, 3.5833};
  float y[l] ={6.5, 4.1667, 3.9167, 3.9167, 4.5, 5.9167, 5.8333, 4.9167, 3.5, 2.9167, 2.5833, 2.5833, 2.8333, 3.3333, 5.25, 5.75, 5.6667, 4.9167, 3.9167, 2.5833, 2.1667, 2.25, 2.3333, 2.9167, 3.9167, 5.0, 5.5, 5.5833, 4.5833, 3.6667, 3.1667, 2.8333, 2.9167, 3.5, 4.5833, 5.3333, 6.0833, 7.1667, 6.5833, 5.9167, 5.8333, 6.1667, 6.6667, 8.0, 8.9167, 9.4167, 9.75, 9.8333, 9.8333, 9.5, 9.0, 8.3333, 7.5833, 6.9167, 6.5};

  for(i=0;i<l;i+=1){
    go(x[i],y[i]);  
    delay(dly);
  }
}

void head(){
  int l=128;
  float x[l] ={7.0, 6.92, 6.92, 7.0, 7.0, 7.08, 7.08, 7.17, 7.17, 7.33, 7.5, 7.58, 8.17, 8.25, 8.42, 8.5, 8.67, 8.83, 8.83, 8.75, 8.75, 8.92, 8.92, 8.83, 8.75, 8.75, 8.83, 8.92, 9.0, 8.92, 8.92, 9.08, 9.17, 9.25, 9.33, 9.42, 9.25, 9.25, 9.08, 9.08, 9.0, 9.0, 8.83, 8.83, 8.75, 8.75, 8.67, 8.67, 8.75, 8.75, 8.67, 8.67, 8.58, 8.58, 8.5, 8.5, 8.33, 8.33, 8.17, 8.17, 7.75, 7.67, 7.42, 7.33, 7.25, 7.17, 7.08, 7.0, 6.92, 6.75, 6.67, 6.5, 6.42, 6.17, 6.08, 4.67, 4.58, 4.33, 4.25, 4.08, 4.0, 3.83, 3.75, 3.67, 3.5, 3.42, 2.92, 2.92, 2.75, 2.75, 2.67, 2.67, 2.58, 2.58, 2.5, 2.5, 2.58, 2.58, 2.67, 2.67, 2.75, 2.75, 2.83, 2.83, 2.92, 2.92, 3.08, 3.08, 3.17, 3.17, 3.33, 3.33, 3.42, 3.42, 3.5, 3.5, 3.58, 3.58, 3.67, 3.67, 3.58, 3.58, 3.5, 3.5, 3.42, 3.42, 3.33, 3.25};
  float y[l] ={10.08, 10.0, 9.92, 9.83, 9.5, 9.42, 9.25, 9.17, 9.08, 8.92, 8.92, 9.0, 9.0, 9.08, 9.08, 9.0, 9.0, 8.83, 8.33, 8.25, 8.08, 7.92, 7.75, 7.75, 7.67, 7.58, 7.5, 7.5, 7.42, 7.33, 6.92, 6.75, 6.75, 6.67, 6.67, 6.58, 6.42, 6.33, 6.17, 6.08, 6.0, 5.92, 5.75, 5.67, 5.58, 5.5, 5.42, 5.25, 5.17, 4.67, 4.58, 4.25, 4.17, 4.0, 3.92, 3.75, 3.58, 3.5, 3.33, 3.25, 2.83, 2.83, 2.58, 2.58, 2.5, 2.5, 2.42, 2.42, 2.33, 2.33, 2.25, 2.25, 2.17, 2.17, 2.08, 2.08, 2.17, 2.17, 2.25, 2.25, 2.33, 2.33, 2.42, 2.42, 2.58, 2.58, 3.08, 3.17, 3.33, 3.5, 3.58, 3.75, 3.83, 4.17, 4.25, 4.83, 4.92, 5.42, 5.5, 5.75, 5.83, 6.0, 6.08, 6.25, 6.33, 6.42, 6.58, 6.67, 6.75, 6.83, 7.0, 7.08, 7.17, 7.25, 7.33, 7.42, 7.5, 7.75, 7.83, 9.0, 9.08, 9.42, 9.5, 9.75, 9.83, 9.92, 10.0, 10.0};

  for(i=0;i<l;i+=1){
    go(x[i],y[i]+1);  
    delay(dly);
  }
}

void heart(){
  int l=65;
  float x[l] ={5.92, 6.25, 6.58, 6.92, 7.17, 7.58, 7.92, 8.42, 9.0, 9.5, 10.0, 10.42, 10.83, 11.33, 11.58, 11.83, 11.92, 11.92, 11.75, 11.5, 11.25, 10.83, 10.42, 9.83, 9.17, 8.58, 8.0, 7.42, 7.08, 6.67, 6.42, 6.0, 5.5, 5.0, 4.42, 3.92, 3.42, 3.0, 2.5, 2.0, 1.67, 1.33, 1.0, 0.58, 0.33, 0.08, 0.08, 0.17, 0.42, 0.75, 1.17, 1.58, 2.0, 2.58, 3.08, 3.5, 3.83, 4.33, 4.75, 5.0, 5.25, 5.58, 5.67, 5.83, 6.0};
  float y[l] ={2.25, 1.92, 1.5, 1.0, 0.67, 0.5, 0.33, 0.25, 0.17, 0.17, 0.33, 0.5, 0.83, 1.17, 1.67, 2.42, 3.33, 4.0, 4.58, 5.33, 5.83, 6.5, 7.33, 8.08, 8.83, 9.5, 10.17, 10.67, 11.08, 11.33, 11.67, 12.17, 11.58, 11.0, 10.5, 9.92, 9.33, 8.92, 8.25, 7.75, 7.17, 6.67, 6.08, 5.42, 4.75, 3.83, 3.0, 2.17, 1.67, 1.25, 0.83, 0.5, 0.17, 0.08, 0.08, 0.17, 0.17, 0.25, 0.5, 0.75, 1.08, 1.33, 1.67, 2.0, 2.33};

  for(i=0;i<l;i+=1){
    go(x[i],y[i]+2);  
    delay(dly);
  }
}

void house(){
  int l=112;
  float x[l] ={1.4167, 1.4167, 1.4167, 1.4167, 1.4167, 1.4167, 1.4167, 1.4167, 1.0833, 0.8333, 0.5833, 0.25, 0.25, 0.5833, 0.9167, 1.25, 1.6667, 2.0833, 2.5, 2.9167, 3.25, 3.5833, 3.9167, 4.25, 4.5833, 5.0, 5.3333, 5.75, 6.0, 6.3333, 6.6667, 7.0, 7.25, 7.5, 7.6667, 7.75, 7.6667, 7.6667, 7.6667, 8.0, 8.3333, 8.5833, 8.9167, 9.0, 8.9167, 9.0, 9.0, 9.0, 9.0, 8.9167, 8.9167, 9.1667, 9.4167, 9.6667, 10.0, 10.25, 10.5833, 10.8333, 11.0833, 11.4167, 11.5833, 11.5833, 11.3333, 11.0833, 10.8333, 10.5833, 10.5833, 10.5833, 10.5833, 10.5833, 10.5833, 10.5833, 10.5833, 10.5833, 10.5833, 10.5833, 10.5833, 10.5833, 10.5833, 10.5833, 10.5833, 10.3333, 10.0, 9.6667, 9.25, 8.9167, 8.4167, 8.0, 7.5833, 7.25, 6.75, 6.4167, 6.0, 5.75, 5.3333, 5.0, 4.5833, 4.0833, 3.8333, 3.5833, 3.25, 2.8333, 2.5833, 2.0833, 1.9167, 1.75, 1.4167, 1.4167, 1.4167, 1.4167, 1.4167, 1.4167};
  float y[l] ={7.5, 7.0, 6.5, 6.0, 5.5833, 5.25, 4.75, 4.4167, 4.4167, 4.4167, 4.4167, 4.4167, 4.0833, 3.8333, 3.6667, 3.4167, 3.0833, 2.8333, 2.5833, 2.4167, 2.25, 2.0, 1.6667, 1.5, 1.25, 1.0, 0.8333, 0.5833, 0.4167, 0.5833, 0.6667, 0.9167, 1.0, 1.1667, 1.25, 1.0, 0.8333, 0.5, 0.3333, 0.3333, 0.3333, 0.3333, 0.3333, 0.5, 0.5833, 0.9167, 1.25, 1.5, 1.75, 1.9167, 2.1667, 2.3333, 2.5, 2.6667, 2.8333, 3.0, 3.1667, 3.3333, 3.5, 3.6667, 3.75, 4.1667, 4.1667, 4.1667, 4.1667, 4.1667, 4.3333, 4.5, 4.8333, 5.1667, 5.5, 5.9167, 6.1667, 6.4167, 6.6667, 6.9167, 7.1667, 7.4167, 7.6667, 7.9167, 8.3333, 8.3333, 8.3333, 8.3333, 8.3333, 8.3333, 8.3333, 8.3333, 8.3333, 8.3333, 8.3333, 8.3333, 8.3333, 8.3333, 8.3333, 8.3333, 8.3333, 8.3333, 8.3333, 8.3333, 8.3333, 8.3333, 8.3333, 8.3333, 8.3333, 8.3333, 8.3333, 8.1667, 8.0, 7.9167, 7.6667, 7.5};

  for(i=0;i<l;i+=1){
    go(x[i],y[i]+1);  
    delay(dly);
  }
}

void f22(){
  int l=102;
  float x[l] ={1.8333, 2.1667, 2.4167, 2.75, 3.0, 3.3333, 3.5, 3.8333, 4.0, 4.0, 4.0, 4.0, 4.25, 4.5, 4.5, 4.5833, 4.5833, 4.6667, 4.75, 4.8333, 4.9167, 5.0, 5.0833, 5.1667, 5.1667, 5.25, 5.25, 5.25, 5.25, 5.25, 5.4167, 5.5833, 5.75, 5.75, 5.75, 5.8333, 5.8333, 5.8333, 5.9167, 6.0833, 6.25, 6.5, 6.6667, 6.9167, 7.1667, 7.3333, 7.5833, 7.8333, 7.8333, 7.8333, 7.8333, 7.8333, 7.6667, 7.5, 7.25, 7.0, 6.75, 6.4167, 6.0833, 6.1667, 6.3333, 6.5833, 6.75, 6.8333, 6.8333, 6.8333, 6.8333, 6.8333, 6.6667, 6.5, 6.25, 6.0, 5.75, 5.5833, 5.5833, 5.5, 5.1667, 4.8333, 4.5833, 4.3333, 4.3333, 4.3333, 4.1667, 4.0, 3.9167, 3.6667, 3.3333, 3.0, 3.0, 3.0, 3.1667, 3.4167, 3.6667, 3.3333, 3.0, 2.6667, 2.3333, 2.0, 1.9167, 1.8333, 1.75, 1.8333};
  float y[l] ={7.5833, 7.25, 7.0, 6.8333, 6.5, 6.25, 5.9167, 5.6667, 5.3333, 4.9167, 4.5833, 4.25, 4.0833, 3.9167, 3.5, 3.0833, 2.75, 2.3333, 2.0, 1.75, 1.8333, 1.9167, 2.1667, 2.4167, 2.6667, 2.9167, 3.1667, 3.4167, 3.6667, 3.9167, 4.0833, 4.1667, 4.25, 4.4167, 4.6667, 4.9167, 5.0833, 5.3333, 5.5833, 5.75, 5.9167, 6.0833, 6.25, 6.5, 6.75, 7.0, 7.1667, 7.4167, 7.5833, 7.6667, 7.9167, 8.1667, 8.1667, 8.3333, 8.4167, 8.5, 8.5833, 8.6667, 8.75, 9.0, 9.0833, 9.25, 9.5, 9.5, 9.5833, 9.75, 9.9167, 10.0833, 10.1667, 10.25, 10.25, 10.0833, 9.9167, 9.75, 9.5, 9.3333, 9.25, 9.25, 9.25, 9.25, 9.3333, 9.5833, 9.75, 10.0, 10.0833, 10.25, 10.25, 10.1667, 10.0, 9.6667, 9.4167, 9.1667, 8.9167, 8.6667, 8.5833, 8.5, 8.4167, 8.25, 8.0, 7.6667, 7.5833, 7.4167};

  for(i=0;i<l;i+=1){
    go(x[i],y[i]+1);  
    delay(dly);
  }
}

void butterfly(){
  int l=133;
  float x[l] ={3.333, 3.75, 4.083, 4.417, 4.75, 5.083, 5.333, 5.667, 5.833, 6.25, 6.583, 6.917, 7.167, 7.333, 7.583, 7.75, 8.083, 8.333, 8.667, 9.083, 9.417, 9.75, 10.083, 10.5, 10.917, 11.333, 11.667, 11.667, 11.667, 11.667, 11.583, 11.583, 11.417, 11.25, 11.083, 11.0, 10.917, 10.833, 10.833, 10.75, 10.5, 10.083, 9.75, 9.417, 9.083, 8.833, 9.0, 9.417, 9.667, 9.917, 10.083, 10.25, 10.333, 10.417, 10.417, 10.333, 10.333, 10.083, 10.0, 9.75, 9.583, 9.25, 8.917, 8.667, 8.333, 8.083, 7.833, 7.5, 7.333, 7.333, 7.167, 7.0, 6.917, 6.75, 6.667, 6.583, 6.5, 6.333, 6.083, 5.917, 5.833, 5.833, 5.667, 5.667, 5.583, 5.583, 5.417, 5.25, 5.0, 4.667, 4.417, 4.083, 3.75, 3.417, 3.0, 2.667, 2.417, 2.25, 2.083, 2.083, 2.25, 2.333, 2.583, 2.917, 3.167, 3.333, 3.083, 2.917, 2.5, 2.25, 2.0, 1.667, 1.583, 1.333, 1.25, 1.083, 1.083, 0.917, 0.667, 0.417, 0.333, 0.25, 0.25, 0.583, 0.917, 1.25, 1.75, 2.0, 2.25, 2.583, 2.667, 2.917, 3.083};
  float y[l] ={1.667, 1.917, 2.25, 2.5, 2.833, 3.0, 3.25, 3.5, 3.75, 3.833, 3.833, 3.583, 3.25, 2.917, 2.75, 2.583, 2.25, 1.917, 1.667, 1.25, 1.167, 0.917, 0.583, 0.583, 0.5, 0.417, 0.5, 0.667, 1.0, 1.25, 1.5, 1.833, 2.083, 2.333, 2.583, 2.917, 3.25, 3.5, 3.833, 4.083, 4.333, 4.333, 4.333, 4.333, 4.167, 4.25, 4.5, 4.667, 4.833, 5.0, 5.167, 5.417, 5.667, 6.0, 6.333, 6.667, 7.0, 7.25, 7.5, 7.667, 7.833, 7.917, 8.167, 8.25, 8.333, 8.333, 8.333, 8.167, 7.917, 7.583, 7.333, 7.0, 6.833, 6.667, 6.417, 6.167, 6.0, 6.0, 6.0, 6.0, 6.25, 6.5, 6.75, 7.083, 7.417, 7.667, 8.167, 8.25, 8.333, 8.5, 8.5, 8.5, 8.5, 8.333, 8.167, 7.917, 7.583, 7.25, 6.833, 6.333, 6.0, 5.583, 5.25, 5.0, 4.833, 4.667, 4.583, 4.583, 4.583, 4.583, 4.583, 4.5, 4.083, 3.75, 3.333, 3.0, 2.667, 2.333, 2.083, 1.833, 1.5, 1.25, 0.75, 0.583, 0.583, 0.583, 0.667, 0.833, 1.0, 1.083, 1.25, 1.25, 1.417};

  for(i=0;i<l;i+=1){
    go(x[i],y[i]+2);  
    delay(dly);
  }
}

void lamp(){
  int l=114;
  float x[l] ={0.5833, 1.0, 1.3333, 1.75, 2.1667, 2.6667, 3.1667, 3.6667, 4.1667, 4.5833, 5.0, 5.25, 5.0833, 5.0833, 5.0833, 4.75, 4.4167, 4.25, 3.9167, 3.8333, 3.8333, 3.9167, 4.0, 4.1667, 4.3333, 4.5, 4.6667, 4.6667, 4.6667, 4.6667, 4.6667, 4.6667, 4.6667, 4.75, 4.75, 4.9167, 5.0833, 5.25, 5.4167, 5.5833, 5.75, 5.8333, 6.0, 6.0833, 6.1667, 6.25, 6.25, 6.25, 6.3333, 6.3333, 6.25, 6.0833, 6.0, 5.9167, 5.75, 5.6667, 5.4167, 5.3333, 5.25, 5.25, 5.25, 5.25, 5.25, 5.25, 5.5, 5.9167, 6.3333, 6.75, 7.1667, 7.5833, 8.0, 8.4167, 8.8333, 9.25, 9.6667, 9.5833, 9.5, 9.4167, 9.3333, 9.1667, 9.0, 8.6667, 8.5, 8.25, 7.9167, 7.75, 7.4167, 7.0833, 6.75, 6.4167, 6.0, 5.5833, 5.25, 4.75, 4.3333, 4.0, 3.5833, 3.25, 2.9167, 2.5833, 2.3333, 2.0, 1.75, 1.5833, 1.4167, 1.1667, 1.0, 0.8333, 0.75, 0.6667, 0.6667, 0.5833, 0.5833, 0.5833};
  float y[l] ={7.4167, 7.1667, 7.0, 6.9167, 6.8333, 6.8333, 6.6667, 6.6667, 6.6667, 6.6667, 6.6667, 6.5833, 6.5, 6.1667, 5.75, 5.6667, 5.5833, 5.3333, 5.0, 4.5833, 4.1667, 3.75, 3.5, 3.1667, 2.75, 2.5, 2.1667, 1.8333, 1.5, 1.1667, 0.9167, 0.6667, 0.3333, 0.5833, 0.8333, 0.9167, 1.0, 1.25, 1.4167, 1.6667, 1.9167, 2.1667, 2.3333, 2.6667, 2.9167, 3.1667, 3.5, 3.75, 4.0, 4.25, 4.5, 4.75, 5.0, 5.1667, 5.3333, 5.3333, 5.4167, 5.5, 5.6667, 6.0, 6.0833, 6.3333, 6.4167, 6.5833, 6.6667, 6.6667, 6.6667, 6.6667, 6.6667, 6.75, 6.8333, 6.8333, 7.0, 7.0833, 7.25, 7.5833, 7.9167, 8.25, 8.5833, 8.9167, 9.3333, 9.5, 9.8333, 10.1667, 10.3333, 10.5833, 10.6667, 10.9167, 11.0833, 11.25, 11.25, 11.3333, 11.3333, 11.3333, 11.25, 11.1667, 11.1667, 11.0, 10.8333, 10.75, 10.5833, 10.4167, 10.1667, 9.9167, 9.6667, 9.5, 9.25, 9.0, 8.8333, 8.5, 8.3333, 8.1667, 7.8333, 7.4167};

  for(i=0;i<l;i+=1){
    go(x[i],y[i]+2);  
    delay(dly);
  }
}

void tree(){
  int l=79;
  float x[l] ={3.08, 3.42, 3.58, 3.75, 3.75, 3.75, 3.75, 3.67, 3.17, 2.58, 2.17, 1.58, 1.08, 0.83, 0.67, 0.42, 0.17, 0.17, 0.42, 0.75, 1.0, 1.25, 1.25, 1.42, 1.67, 2.08, 2.5, 2.83, 3.17, 3.42, 3.58, 3.92, 4.25, 4.5, 4.83, 5.0, 5.33, 5.67, 6.0, 6.25, 6.67, 6.83, 7.0, 7.25, 7.58, 7.92, 8.08, 8.17, 8.17, 8.17, 7.92, 8.0, 8.25, 8.33, 8.5, 8.58, 8.58, 8.42, 8.25, 8.0, 7.75, 7.5, 7.17, 6.67, 6.25, 5.92, 5.75, 5.42, 5.17, 5.08, 5.0, 5.0, 5.0, 5.08, 5.17, 5.33, 5.5, 5.75, 5.92};
  float y[l] ={11.0, 10.25, 9.67, 9.0, 8.42, 7.67, 6.92, 6.33, 6.33, 6.17, 6.25, 6.33, 6.17, 5.67, 5.0, 4.58, 4.17, 3.5, 3.08, 2.67, 2.5, 2.42, 2.0, 1.58, 1.33, 1.17, 1.0, 1.08, 1.25, 1.25, 1.0, 0.92, 1.0, 1.08, 0.92, 0.67, 0.67, 0.58, 0.58, 0.67, 0.67, 0.92, 1.25, 1.17, 1.42, 1.5, 1.92, 2.17, 2.58, 2.92, 3.17, 3.33, 3.58, 3.75, 4.17, 4.5, 4.92, 5.33, 5.75, 5.92, 6.08, 6.33, 6.5, 6.5, 6.5, 6.33, 6.17, 6.17, 6.33, 6.67, 6.92, 7.42, 8.0, 8.5, 9.0, 9.42, 9.92, 10.33, 10.83};

  for(i=0;i<l;i+=1){
    go(x[i],y[i]+2);  
    delay(dly);
  }
}

void A(){
  int l=14;
  float x[l] ={3.5833, 4.25, 5.5833, 6.25, 7.5, 8.25, 7.5, 4.25, 7.5, 8.25, 6.25, 5.5833, 4.25, 3.5833};
  float y[l] ={8.1667, 6.1667, 2.4167, 2.4167, 6.1667, 8.1667, 6.1667, 6.1667, 6.1667, 8.1667, 2.4167, 2.4167, 6.1667, 8.1667};

  for(i=0;i<l;i+=1){
    go(x[i],y[i]);  
    delay(dly);
  }
}

void square(){
  for(i=0;i<10;i++){
    go(0,i);  
    delay(dly);
  } 
  for (i=0;i<10;i++){
    go(i,10);  
    delay(dly);
  }
  for(i=10;i>0;i-=1){
    go(10,i);
    delay(dly);
  }
  for(i=10;i>0;i-=1){
    go(i,0);
    delay(dly);
  }
}

void line(){

    for(i=0;i<10;i++){
      go(i+4,4);
      delay(dly);
      }
    for(i=10;i>0;i--){
      go(i+4,4);
      delay(dly);
      }
}

void working_envelop(){
  
  for(float x=16;x>=0;x-=0.20){
    go(x,1);  
    delay(50);
  }
  
  m2.write(20);
  
  for (i=150;i<180;i+=1){
    m1.write(i); 
    delay(50);
  }  

  for (i=20;i<170;i+=1){
    m2.write(i);
    delay(15);
  }

  for(i=180;i>10;i-=1){
    m1.write(i);
    delay(25);
  }
}

void working_envelop_one(){
  for(i=0;i<180;i+=1){
    m1.write(i);
    delay(25);  
  }
  
  for(i=180;i>0;i-=1){
    m1.write(i);
    delay(25);  
  }  
}

void loop() {
 

  working_envelop();
  
  star();
  tree();
  lamp();
  human();
  house();
  heart();
  hand();
  f22();
  butterfly();
  A();
  
  delay(500);
}

Credits

Robotics EveryDay

Robotics EveryDay

0 projects • 9 followers

Comments