cckiu8
This commit is contained in:
26
README.md
26
README.md
@@ -5,7 +5,31 @@ Carro autónomo basado en el tarjeta esp32 MH-ET LIVE
|
|||||||
|
|
||||||
Para controlar los motores del carro usamos un driver TB6612FNG, el cual es un módulo que nos permite controlar 2 motores con una corriente de 1.2 A (3.2 A corriente pico) y un voltaje de 15 V
|
Para controlar los motores del carro usamos un driver TB6612FNG, el cual es un módulo que nos permite controlar 2 motores con una corriente de 1.2 A (3.2 A corriente pico) y un voltaje de 15 V
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
---
|
||||||
|
## Conexiones:
|
||||||
|
|
||||||
|
### TB6612FNG
|
||||||
|
|
||||||
|
PWMA --> GPIO36 --> 5
|
||||||
|
AI2 --> GPIO39 --> 8
|
||||||
|
AI1 --> GPIO34 --> 10
|
||||||
|
STBY --> GPIO35 --> 11
|
||||||
|
BI1 --> GPIO32 --> 12
|
||||||
|
BI2 --> GPIO33 --> 13
|
||||||
|
|
||||||
|
### Sensor TCRT5000
|
||||||
|
|
||||||
|
OUT1 --> GPIO15 --> ADC2_3 --> A13
|
||||||
|
OUT2 --> GPIO14 --> ADC2_2 --> A16
|
||||||
|
OUT3 --> GPIO12 --> ADC2_1 --> A15
|
||||||
|
OUT4 --> GPIO4 --> ADC2_0 --> A10
|
||||||
|
OUT5 --> GPIO13 --> ADC2_4 --> A14
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
---
|
---
|
||||||
Alimentación:
|
Alimentación:
|
||||||
|
|||||||
@@ -13,3 +13,4 @@ platform = espressif32
|
|||||||
board = mhetesp32devkit
|
board = mhetesp32devkit
|
||||||
framework = arduino
|
framework = arduino
|
||||||
|
|
||||||
|
monitor_speed = 115200
|
||||||
43
firmwareCarroEsp32/src/carroEsp32.h
Normal file
43
firmwareCarroEsp32/src/carroEsp32.h
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
#ifndef CARROESP32_h
|
||||||
|
#define CARROESP32_h
|
||||||
|
#define OUT1 A13
|
||||||
|
#define OUT2 A16
|
||||||
|
#define OUT3 A15
|
||||||
|
#define OUT4 A10
|
||||||
|
#define OUT5 A14
|
||||||
|
|
||||||
|
int sensores[5] = {0, 0, 0, 0, 0};
|
||||||
|
|
||||||
|
void readSensors()
|
||||||
|
{
|
||||||
|
sensores[0] = analogRead(OUT1);
|
||||||
|
sensores[1] = analogRead(OUT2);
|
||||||
|
sensores[2] = analogRead(OUT3);
|
||||||
|
sensores[3] = analogRead(OUT4);
|
||||||
|
sensores[4] = analogRead(OUT5);
|
||||||
|
}
|
||||||
|
|
||||||
|
void printSensores()
|
||||||
|
{
|
||||||
|
for (int i = 0; i < 5; i++)
|
||||||
|
{
|
||||||
|
Serial.print(sensores[i]);
|
||||||
|
Serial.print(',');
|
||||||
|
}
|
||||||
|
Serial.println();
|
||||||
|
}
|
||||||
|
|
||||||
|
void init_sensores(){
|
||||||
|
pinMode(OUT1, INPUT);
|
||||||
|
pinMode(OUT2, INPUT);
|
||||||
|
pinMode(OUT3, INPUT);
|
||||||
|
pinMode(OUT4, INPUT);
|
||||||
|
pinMode(OUT5, INPUT);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# endif
|
||||||
@@ -1,9 +1,27 @@
|
|||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
|
#include "BluetoothSerial.h"
|
||||||
|
#include "carroEsp32.h"
|
||||||
|
|
||||||
|
BluetoothSerial ESP_BT; //Object for Bluetooth
|
||||||
|
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
// put your setup code here, to run once:
|
init_sensores();
|
||||||
|
Serial.begin(115200);
|
||||||
|
Serial.println("Carro Esp32");
|
||||||
|
ESP_BT.begin("CARRO ESP32"); //Name of your Bluetooth Signal
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
// put your main code here, to run repeatedly:
|
|
||||||
|
if (ESP_BT.available()) //Check if we receive anything from Bluetooth
|
||||||
|
{
|
||||||
|
//incoming = ESP_BT.read(); //Read what we recevive
|
||||||
|
Serial.print("Received:"); Serial.println(ESP_BT.read());
|
||||||
}
|
}
|
||||||
|
//readSensors();
|
||||||
|
//printSensores();
|
||||||
|
//delay(500);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user