- Apple iPhone 17 Pro Max – fennsík
- Azonnali navigációs kérdések órája
- Xiaomi 15T Pro - a téma nincs lezárva
- Google Pixel 10 Pro XL – tíz kicsi Pixel
- Hiánypótló funkciót vezet be a Nothing
- Samsung Galaxy S22 Ultra - na, kinél van toll?
- iPhone topik
- Fotók, videók mobillal
- Android alkalmazások - szoftver kibeszélő topik
- Okosóra és okoskiegészítő topik
-
Mobilarena
Arduino hardverrel és szoftverrel foglakozó téma. Minden mikrovezérlő ami arduinoval programozható, és minden arduino program, board, és hardverrel kapcsolatos kérdések helye.
Új hozzászólás Aktív témák
-
junhum
tag
Sziasztok!
Nem jövök rá, hogy mit kellene átírnom.
Nano+i2cLCD+DHT22// then define the LCD
#include <Wire.h>
#include <LCD.h>
#include <LiquidCrystal_I2C.h>
#define I2C_ADDR 0x27 // <<- Add your address here.
#define Rs_pin 0
#define Rw_pin 1
#define En_pin 2
#define BACKLIGHT_PIN 3
#define D4_pin 4
#define D5_pin 5
#define D6_pin 6
#define D7_pin 7
LiquidCrystal_I2C lcd(I2C_ADDR, En_pin, Rw_pin, Rs_pin, D4_pin, D5_pin, D6_pin, D7_pin);
#include "DHT.h"
#define DHTPIN 2 // what digital pin we're connected to
#define DHTTYPE DHT22 // DHT 22 (AM2302), AM2321
DHT dht(DHTPIN, DHTTYPE);
void setup(void) {
lcd.begin (16, 2); // <<-- change for your LCD size if needed
//LCD Backlight ON
lcd.setBacklightPin(BACKLIGHT_PIN, POSITIVE);
lcd.setBacklight(HIGH);
lcd.home (); // go home on LCD
lcd.print("Your temperature:");
lcd.clear();
Serial.begin(9600);
Serial.println("DHTxx test!");
dht.begin();
delay(1500);
}
void loop(void) {
delay(2000);
int chk = dht.read(DHTPIN);
float h = dht.readHumidity();
// Read temperature as Celsius (the default)
float t = dht.readTemperature();
// Read temperature as Fahrenheit (isFahrenheit = true)
float f = dht.readTemperature(true);
// Check if any reads failed and exit early (to try again).
if (isnan(h) || isnan(t) || isnan(f)) {
Serial.println("Failed to read from DHT sensor!");
return;
}
// Compute heat index in Fahrenheit (the default)
float hif = dht.computeHeatIndex(f, h);
// Compute heat index in Celsius (isFahreheit = false)
float hic = dht.computeHeatIndex(t, h, false);
Serial.print("Humidity: ");
Serial.print(h);
Serial.print(" %\t");
Serial.print("Temperature: ");
Serial.print(t);
Serial.print(" *C ");
Serial.print(f);
Serial.print(" *F\t");
Serial.print("Heat index: ");
Serial.print(hic);
Serial.print(" *C ");
Serial.print(hif);
Serial.println(" *F");
lcd.setCursor (0,1); // go to start of 2nd line
lcd.print("C=");
lcd.print((float)DHT.temperature, 0);
lcd.print(" H=");
lcd.print((float)DHT.humidity, 0);
lcd.print("%");
delay(1000);
lcd.clear();
}Az lcd.print((float)DHT.temperature, 0); és a humidity-nél ezt dobja:
termometar_lcd:82: error: expected primary-expression before '.' token
lcd.print((float)DHT.temperature, 0);
^
termometar_lcd:85: error: expected primary-expression before '.' token
lcd.print((float)DHT.humidity, 0);
^
exit status 1
expected primary-expression before '.' tokenTöbb kódot ollózok össze és hiányában
Új hozzászólás Aktív témák
- Corsair SF850L Gold 850W SFX Moduláris Tápegység
- Corsair RM1000X Gold 1000W Moduláris Tápegység PCIE 5 ATX 3 12VHPWR
- Lenovo ThinkPad P15 Tervező Vágó Laptop -50% 15,6" i7-10750H 16/512 QUADRO T1000 4GB
- MAKULÁTLAN! Dell Precision 7760 Tervező Vágó Laptop -70% 17,3" i7-11850H 32/1TB NVIDIA A3000 6GB FHD
- Kiwiears Astral
- ÁRGARANCIA!Épített KomPhone Ryzen 5 7600X 32/64GB RAM RX 7800 XT 16GB GAMER PC termékbeszámítással
- HP 65W töltő eladó
- HIBÁTLAN iPhone 11 Pro 64GB Midnight Green -1 ÉV GARANCIA -Kártyafüggetlen, MS3372
- ÁRGARANCIA!Épített KomPhone Ryzen 5 7500F 32/64GB DDR5 RTX 5060 8GB GAMER PC termékbeszámítással
- Telefon felvásárlás!! iPhone 14/iPhone 14 Plus/iPhone 14 Pro/iPhone 14 Pro Max
Állásajánlatok
Cég: Laptopműhely Bt.
Város: Budapest
Cég: PCMENTOR SZERVIZ KFT.
Város: Budapest