cckiu8
This commit is contained in:
@@ -13,3 +13,4 @@ platform = espressif32
|
||||
board = mhetesp32devkit
|
||||
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 "BluetoothSerial.h"
|
||||
#include "carroEsp32.h"
|
||||
|
||||
BluetoothSerial ESP_BT; //Object for Bluetooth
|
||||
|
||||
|
||||
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() {
|
||||
// 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