This commit is contained in:
2019-08-05 22:34:11 -05:00
parent 9a6b8b6a16
commit 6c4cdab3bc
4 changed files with 90 additions and 4 deletions

View File

@@ -13,3 +13,4 @@ platform = espressif32
board = mhetesp32devkit
framework = arduino
monitor_speed = 115200

View 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

View File

@@ -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);
}