Panel Cookies
Hexapod Robot

Help me by sharing this post


PART 5 - Code

Get the code from below. Arduino IDE should have all those libraries. Just compile and uplaod it to the Arduino MEGA. Select MEGA board and the COM. Then connect the App and thest the robot. You might need to change the home position values for each servo so make some tests and change tose valeus in the code as you can see below.

#include       // We use software serial on pins D12 and D8 for HC06
SoftwareSerial Bluetooth(12, 9); // Arduino RX 12 and TX 9 -> HC-06 Bluetooth TX RX
#include                //We will use servo library

/*/////////////////Initial home position in degrees//////////////////
The first leg is the front left leg as seen from the front
Thew first motor of each leg is the one closer to the robot body*/
int home_Leg1_Mot1 = 75; 
int home_Leg1_Mot2 = 90; 
int home_Leg1_Mot3 = 100;

int home_Leg2_Mot1 = 70;
int home_Leg2_Mot2 = 90;
int home_Leg2_Mot3 = 115;

int home_Leg3_Mot1 = 70;
int home_Leg3_Mot2 = 90;
int home_Leg3_Mot3 = 100;

int home_Leg4_Mot1 = 105;
int home_Leg4_Mot2 = 90;
int home_Leg4_Mot3 = 110;

int home_Leg5_Mot1 = 75;
int home_Leg5_Mot2 = 90;
int home_Leg5_Mot3 = 90;

int home_Leg6_Mot1 = 110;
int home_Leg6_Mot2 = 100;
int home_Leg6_Mot3 = 115;

PART 6 - Test

Open the App. Firstr pait to the HC06 so start the robot. Conenct using 1234 or 0000 password. In teh app click the Blutooth icon and select the HC06. Then start controlling the robot. I hope you like this project. Consider supporting my work on PATREON or support me via PayPal. Thank you.

Help me by sharing this post


3D printed Plane
page 2/2

Affiliate Disclosure


PCBWAY PCB service

Curso Arduino Online nivel bajo