Skip to content

Latest commit

 

History

History
82 lines (72 loc) · 1.49 KB

README.md

File metadata and controls

82 lines (72 loc) · 1.49 KB

Quadruped

Walking quadruped robot using arduino nano + 4 servo motors

Installation

  1. Install Arduino IDE 2.2.1
  2. Install the MightyCore arduino library
  3. Open the .ino file into the Arduino IDE
  4. Select the board and port (Arduino Nano)

Functions

Convert

void convert()
{
count_angle = right_fore + 46;
count_angle1 = right_hind + 46;
count_angle2 = left_fore + 46;
count_angle3 = left_hind + 46;
_delay_us(1200);
}

Home Position

void home_position()
{
right_fore = 90;
right_hind = 90;
left_fore = 90;
left_hind = 90;
} 

Timer

ISR (TIMER1_COMPA_vect)
{
count++;
if (count <= count_angle)
{
  setbit(PORTD, bitn(4));
}
else if ((count > count_angle) && (count < 1818))
{
  clearbit(PORTD, bitn(4));
}
else if (count >= 1818)
{
  count = 0;
}
if (count <= count_angle1)
{
  setbit(PORTD, bitn(5));
}
else if (( count > count_angle1) && (count < 1818))
{
  clearbit(PORTD, bitn(5));
}
if (count <= count_angle2)
{
  setbit(PORTD, bitn(6));
}
else if ((count > count_angle2) && (count < 1818))
{
  clearbit(PORTD, bitn(6));
}
if ( count <= count_angle3)
{
  setbit(PORTD, bitn(7));
}
else if ((count > count_angle3) && (count < 1818))
{
  clearbit(PORTD, bitn(7));
}
}