Skip to content

Commit

Permalink
correct pin maping and uses drv8833 driver now
Browse files Browse the repository at this point in the history
  • Loading branch information
RicardoX2X committed May 22, 2023
1 parent 6987267 commit b6dcd05
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
Binary file added fritzing_hexapod_esp32cam.fzz
Binary file not shown.
13 changes: 3 additions & 10 deletions hexapod_esp32cam.ino
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
// Replace with your network credentials
const char* ssid = "coquinha gelada";
const char* password = "coquinhagelada1";
int speed = 255;

#define PART_BOUNDARY "123456789000000000000987654321"

Expand All @@ -36,11 +35,10 @@ int speed = 255;
#define PCLK_GPIO_NUM 22

//===================================
#define MTR_PWM 13
#define MOTOR_1_PIN_1 14
#define MOTOR_1_PIN_1 13
#define MOTOR_1_PIN_2 15
#define MOTOR_2_PIN_1 2
#define MOTOR_2_PIN_2 4
#define MOTOR_2_PIN_1 4
#define MOTOR_2_PIN_2 2

static const char* _STREAM_CONTENT_TYPE = "multipart/x-mixed-replace;boundary=" PART_BOUNDARY;
static const char* _STREAM_BOUNDARY = "\r\n--" PART_BOUNDARY "\r\n";
Expand Down Expand Up @@ -153,31 +151,27 @@ static esp_err_t cmd_handler(httpd_req_t *req){
digitalWrite(MOTOR_1_PIN_2, 0);
digitalWrite(MOTOR_2_PIN_1, 0);
digitalWrite(MOTOR_2_PIN_2, 0);
ledcWrite(5, speed);
}
else if(!strcmp(variable, "left")) {
Serial.println("Left");
digitalWrite(MOTOR_1_PIN_1, 0);
digitalWrite(MOTOR_1_PIN_2, 0);
digitalWrite(MOTOR_2_PIN_1, 1);
digitalWrite(MOTOR_2_PIN_2, 0);
ledcWrite(5, speed);
}
else if(!strcmp(variable, "right")) {
Serial.println("Right");
digitalWrite(MOTOR_1_PIN_1, 0);
digitalWrite(MOTOR_1_PIN_2, 0);
digitalWrite(MOTOR_2_PIN_1, 0);
digitalWrite(MOTOR_2_PIN_2, 1);
ledcWrite(5, speed);
}
else if(!strcmp(variable, "backward")) {
Serial.println("Backward");
digitalWrite(MOTOR_1_PIN_1, 0);
digitalWrite(MOTOR_1_PIN_2, 1);
digitalWrite(MOTOR_2_PIN_1, 0);
digitalWrite(MOTOR_2_PIN_2, 0);
ledcWrite(5, speed);
}
else if(!strcmp(variable, "stop")) {
Serial.println("Stop");
Expand Down Expand Up @@ -244,7 +238,6 @@ void setup() {

// Motor uses PWM Channel 8
ledcSetup(5, 2000, 8);
ledcAttachPin(MTR_PWM, 5);


camera_config_t config;
Expand Down

0 comments on commit b6dcd05

Please sign in to comment.