hi everyone... i'm new at app inventor, but i was able to do an app that can on-off what i want, but what i want to do now it's an app that show me the data from a DHT11 . .. this is what i do, but it shows me nothing on lines "temperatura...., humedad.... & Nivel agua"
ARDUINO CODE:
#include <Wire.h> // incluye libreria para interfaz I2C
#include <DHT.h> // importa la Librerias DHT
#include <DHT_U.h>
#include <SoftwareSerial.h> // libreria que permite establecer pines digitales
// Definimos el pin digital donde se conecta el sensor DHT TEMPERATURA HUMEDAD
#define DHTPIN 2
// Dependiendo del tipo de sensor
#define DHTTYPE DHT11
SoftwareSerial miBT(11, 12); // pin 11 como RX, pin 12 como TX
int TRIG = 10; //DISTANCIA ULTRASONIDO
int ECHO = 9;
int DURACION;
int DISTANCIA;
/// BLUETOOTH
char DATO = 0; // variable para almacenar caracter recibido
///DHT11
int TEMPERATURA;
int HUMEDAD;
DHT dht(DHTPIN, DHTTYPE); // creacion del objeto, cambiar segundo parametro // por DHT11 si se utiliza en lugar del DHT22
///fin DHT22
void setup(){
//bluetooth
miBT.begin(38400); // comunicacion serie entre Arduino y el modulo a 38400 bps
// INICIAR DHT
dht.begin(); // inicializacion de sensor
//DISTANCIA ULTRASONIDO
pinMode (TRIG, OUTPUT);
pinMode (ECHO, INPUT);
Serial.begin(9600);
}
void loop(){
//DISTANCIA ULTRASONIDO
digitalWrite(TRIG, HIGH);
delay(1);
digitalWrite(TRIG, LOW);
DURACION = pulseIn(ECHO, HIGH);
DISTANCIA = DURACION / 5.82;
//BLUETOOTH
if (miBT.available()){ // si hay informacion disponible desde modulo
DATO = miBT.read(); // almacena en DATO el caracter recibido desde modulo
TEMPERATURA = dht.readTemperature(); // obtencion de valor de temperatura
HUMEDAD = dht.readHumidity(); // obtencion de valor de humedad
Serial.println(TEMPERATURA);
Serial.println("|");
Serial.println(HUMEDAD);
Serial.println("|");
Serial.println(DISTANCIA);
Serial.println("|");
}
delay(1000);
}
APP INVENTOR SCREENS