Teplomer
Verzia z 19:09, 18. december 2017, ktorú vytvoril Tiger (diskusia | príspevky) (Vytvorená stránka „ Program: #include<dht.h> #define dht_apin A0 dht DHT; #include<dht.h> #define dht_apin A0 →hociaky komentar aj na viac riadkov: // jednoriadkovy komentar...“)
Program:
- include<dht.h>
- define dht_apin A0
dht DHT;
- include<dht.h>
- define dht_apin A0
/* hociaky komentar
aj na viac riadkov */
// jednoriadkovy komentar // include the library code
- include <Wire.h>
- include <LiquidCrystal_I2C.h>
- include <string.h>
/**********************************************************/ // initialize the library with the numbers of the interface pins LiquidCrystal_I2C lcd(0x27,16,2); // set the LCD address to 0x27 for a 16 chars and 2 line display const int inPin = 0; /*********************************************************/ void setup() {
lcd.init(); //initialize the lcd lcd.backlight(); //open the backlight
} /*********************************************************/ void loop() {
DHT.read11(dht_apin); char slovo[] = " stupnov Celzia "; char str[16]; int value = analogRead(inPin); float millivolts = DHT.temperature; float celsius = millivolts / 1; delay(600);
sprintf(str, " *** %02d.%03d ***", (int)celsius, (int)((celsius - (int)celsius))); lcd.clear(); lcd.setCursor(15,0); for (int positionCounter1 = 0; positionCounter1 < strlen(str); positionCounter1++) { //lcd.scrollDisplayLeft(); //Scrolls the contents of the display one space to the left. lcd.setCursor(positionCounter1 ,0); lcd.print(str[positionCounter1]); // Print a message to the LCD. delay(100); //wait for 250 microseconds } for (int positionCounter1 = 0; positionCounter1 < strlen(slovo); positionCounter1++) { //lcd.scrollDisplayLeft(); //Scrolls the contents of the display one space to the left. lcd.setCursor(positionCounter1,1); lcd.print(slovo[positionCounter1]); // Print a message to the LCD. delay(100); //wait for 250 microseconds }
} /************************************************************/