Quantcast
Channel: LabVIEW topics
Viewing all articles
Browse latest Browse all 68980

Labview dos not shows the temperature and humidity soil as the same between Arduino

$
0
0

good afternoon.

I did que sheme in arduino program and he work good.

As soon as I switch to LABVIEW, the values ​​that appear to me are nothing like those that appear in the Arduino program.

Please help me with this problem.

I send the Arduino code and the labview schematic and some more images of the assembled schematic.

Thanks

 

#include<Keyboard.h>  // Transforma arduino em dispositivo Human Interface Device
#include<KeyboardLayout.h>  // Adiciona suporte a diferentes layouts de teclado
#include<Keyboard_da_DK.h>  // Dinamarquês
#include<Keyboard_de_DE.h>  // Alemão
#include<Keyboard_es_ES.h>  // Espanhol
#include<Keyboard_fr_FR.h>  // Francês
#include<Keyboard_hu_HU.h>  // Húngaro
#include<Keyboard_it_IT.h>  // Italiano
#include<Keyboard_pt_PT.h>  // Português
#include<Keyboard_sv_SE.h>  // Sueco

#include<EEPROM.h>  // Guarda dados no arduino mesmo depois de desligado

#include<LiquidCrystal_I2C.h>  // Controla display LCD via interface I2C

#include<Wire.h>  // Comunicação I2C entre Arduino e display LCD

#include"DHT.h"  // Biblioteca q trabalha c/ sensor temp. e humidade
#defineDHTPIN2  // Pino digital sensor DHT

constint sensorHum = A2;  // Pino analógico onde o sensor Humidade está conectado

# defineDHTTYPE DHT11  // Define o tipo de sensor DHT que está a ser utilizado

DHT dht(DHTPIN, DHTTYPE);  // Associa pino do Arduino DHTPIN e tipo de sensor
// DHTTYPE ao objeto criado DHT

LiquidCrystal_I2C lcd(0x27, 16, 2);  // Definir o endereço do LCD para 0x27
// para um display de 16 caracteres e 2 linhas

// Função setup inicializa os dispositivos, define configurações iniciais
voidsetup(){
  Serial.begin(9600);
  // Serial.println(F("DHTxx teste!"));

  dht.begin();

  lcd.init();

}

voidloop(){
  float leituraTemperatura = dht.readTemperature();  // Lê o valor da temperatura
  int leituraHumidade = analogRead(sensorHum);   // Lê o valor da humidade

  Serial.println(leituraHumidade);   // Exibe o valor no Serial Monitor

  // Verifica se alguma leitura falhou e tenta novamente
  if(isnan(leituraTemperatura)){
    Serial.println(F("Falha de leitura do sensor DHT!"));
    return;
  }

  Serial.println(leituraTemperatura);  // Exibe o valor no Serial Monitor


  lcd.setBacklight(HIGH);  // Liga a luz de fundo do display LCD

  lcd.setCursor(0, 0);  // Primeira coluna e primeira linha
  lcd.print(F("Humidade: "));  // Exibe o texto no display LCD
  lcd.setCursor(10, 0);  // Coluna 10 da primeira linha
  lcd.print(round(leituraHumidade));  // Exibe o valor
  lcd.setCursor(12, 0);  // Coluna 12 da primeira linha
  lcd.print(F(" %"));  // Exibe a %
  delay(1000);  // Arduino pausa 1000 ms (1s)


  lcd.setCursor(0, 1);  // Primeira coluna e segunda linha
  lcd.print(F("Temp: "));  // Exibe o texto no display LCD
  lcd.setCursor(7, 1);  // Coluna 7 da segunda coluna
  lcd.print(round(leituraTemperatura));  // Exibe o valor
  lcd.setCursor(9, 1);  // Coluna 9 da segunda linha
  lcd.write(32);  // Caracter espaço
  lcd.write(223);  // Caracter °
  lcd.print(F("C"));  // Exibe C
  delay(1000);  // Arduino pausa 1000 ms (1s)
}

Viewing all articles
Browse latest Browse all 68980

Trending Articles