- Apple asztali gépek
- AMD K6-III, és minden ami RETRO - Oldschool tuning
- Milyen TV-t vegyek?
- VR topik
- Radeon RX 9060 XT: Ezt aztán jól meghúzták
- Olcsó táblával készül a OnePlus
- Milyen asztali (teljes vagy fél-) gépet vegyek?
- Milyen egeret válasszak?
- Milyen monitort vegyek?
- AMD Ryzen 9 / 7 / 5 7***(X) "Zen 4" (AM5)
-
PROHARDVER!
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
- Cooler Master MWE Bronze V2 750W 80 PLUS Bronze
- MSI MPG Z390 GAMING EDGE AC Alaplap + Intel Core i7-8700K
- ASRock Radeon Challenger Pro RX 6700 XT 12GB OC Videokártya
- MacBook Pro 16 A2141 EMC 3347 27%, 16.1" Retina LCD IPS, i7-9750H, Radeon PRO 5300M, 16, 500, gar
- ASUS GeForce GTX 1070 Ti 8GB GDDR5 256bit
- Csere-Beszámítás! Asus Rog Strix RTX 3070Ti 8GB GDDR6X Videokártya!
- Bomba ár! Lenovo X1 Yoga 2nd - i7-7G I 8GB I 256SSD I 14" WQHD I HDMI I W11 I CAM I Garancia!
- Samsung Galaxy A41 64GB Kártyafüggetlen, 1Év Garanciával
- BESZÁMÍTÁS! Microsoft XBOX Series S 512GB játékkonzol garanciával hibátlan működéssel
- TELJES KÖRŰ IT BESZERZÉS
Állásajánlatok
Cég: PC Trade Systems Kft.
Város: Szeged
Cég: CAMERA-PRO Hungary Kft
Város: Budapest