Teplomer: Rozdiel medzi revíziami

Zo stránky Robotický krúžok
Skočit na navigaci Skočit na vyhledávání
(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...“)
 
Bez shrnutí editace
 
Riadok 5: Riadok 5:


#include<dht.h>
#include<dht.h>


#define dht_apin A0
#define dht_apin A0


dht DHT;
dht DHT;
#include<dht.h>
#include<dht.h>


#define dht_apin A0
#define dht_apin A0


/* hociaky komentar  
/* hociaky komentar  
   aj na viac riadkov */
   aj na viac riadkov */
// jednoriadkovy komentar
// jednoriadkovy komentar
// include the library code
// include the library code
#include <Wire.h>  
#include <Wire.h>  
#include <LiquidCrystal_I2C.h>
#include <LiquidCrystal_I2C.h>
#include <string.h>
#include <string.h>
/**********************************************************/
/**********************************************************/
// initialize the library with the numbers of the interface pins
// 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
LiquidCrystal_I2C lcd(0x27,16,2);  // set the LCD address to 0x27 for a 16 chars and 2 line display
const int inPin = 0;
const int inPin = 0;
/*********************************************************/
 
 
void setup()
void setup()
{
{
   lcd.init();  //initialize the lcd
   lcd.init();  //initialize the lcd
   lcd.backlight();  //open the backlight
   lcd.backlight();  //open the backlight
}
}
/*********************************************************/
/*********************************************************/
void loop()  
void loop()  
{
{
   DHT.read11(dht_apin);
   DHT.read11(dht_apin);
   char slovo[] = " stupnov Celzia ";
   char slovo[] = " stupnov Celzia ";
   char str[16];
   char str[16];
     int value = analogRead(inPin);
     int value = analogRead(inPin);
   float millivolts = DHT.temperature;
   float millivolts = DHT.temperature;
   float celsius = millivolts / 1;
   float celsius = millivolts / 1;
   delay(600);
   delay(600);


     sprintf(str, " *** %02d.%03d ***", (int)celsius, (int)((celsius - (int)celsius)));
     sprintf(str, " *** %02d.%03d ***", (int)celsius, (int)((celsius - (int)celsius)));
     lcd.clear();
     lcd.clear();
     lcd.setCursor(15,0);
     lcd.setCursor(15,0);
     for (int positionCounter1 = 0; positionCounter1 < strlen(str); positionCounter1++)
     for (int positionCounter1 = 0; positionCounter1 < strlen(str); positionCounter1++)
     {
     {
       //lcd.scrollDisplayLeft();  //Scrolls the contents of the display one space to the left.
       //lcd.scrollDisplayLeft();  //Scrolls the contents of the display one space to the left.
       lcd.setCursor(positionCounter1 ,0);
       lcd.setCursor(positionCounter1 ,0);
       lcd.print(str[positionCounter1]);  // Print a message to the LCD.
       lcd.print(str[positionCounter1]);  // Print a message to the LCD.
       delay(100);  //wait for 250 microseconds
       delay(100);  //wait for 250 microseconds
     }   
     }   
     for (int positionCounter1 = 0; positionCounter1 < strlen(slovo); positionCounter1++)
     for (int positionCounter1 = 0; positionCounter1 < strlen(slovo); positionCounter1++)
     {
     {
       //lcd.scrollDisplayLeft();  //Scrolls the contents of the display one space to the left.
       //lcd.scrollDisplayLeft();  //Scrolls the contents of the display one space to the left.
       lcd.setCursor(positionCounter1,1);
       lcd.setCursor(positionCounter1,1);
       lcd.print(slovo[positionCounter1]);  // Print a message to the LCD.
       lcd.print(slovo[positionCounter1]);  // Print a message to the LCD.
       delay(100);  //wait for 250 microseconds
       delay(100);  //wait for 250 microseconds
     }   
     }   
}
}
/************************************************************/
/************************************************************/

Aktuálna revízia z 19:12, 18. december 2017


Program:

  1. include<dht.h>


  1. define dht_apin A0


dht DHT;


  1. include<dht.h>


  1. define dht_apin A0


/* hociaky komentar

  aj na viac riadkov */

// jednoriadkovy komentar

// include the library code


  1. include <Wire.h>


  1. include <LiquidCrystal_I2C.h>


  1. 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


   }  

}


/************************************************************/