3-TOPSHIRIQ
LM335 xarorat datchigi (uzluksiz). Ishlash tamoili, ishlatishga misol.
Kodi:
int baselineTemp = 0;
int celsius = 0;
int fahrenheit = 0;
void setup()
{
pinMode(A0, INPUT);
Serial.begin(9600);
pinMode(2, OUTPUT);
pinMode(3, OUTPUT);
pinMode(4, OUTPUT);
}
void loop()
{
// set threshold temperature to activate LEDs
baselineTemp = 40;
// measure temperature in Celsius
celsius = map(((analogRead(A0) - 20) * 3.04), 0, 1023, -40, 125);
// convert to Fahrenheit
fahrenheit = ((celsius * 9) / 5 + 32);
Serial.print(celsius);
Serial.print(" C, ");
Serial.print(fahrenheit);
Serial.println(" F");
if (celsius < baselineTemp) {
digitalWrite(2, LOW);
digitalWrite(3, LOW);
digitalWrite(4, LOW);
}
if (celsius >= baselineTemp && celsius < baselineTemp + 10) {
digitalWrite(2, HIGH);
digitalWrite(3, LOW);
digitalWrite(4, LOW);
}
if (celsius >= baselineTemp + 10 && celsius < baselineTemp + 20) {
digitalWrite(2, HIGH);
digitalWrite(3, HIGH);
digitalWrite(4, LOW);
}
if (celsius >= baselineTemp + 20 && celsius < baselineTemp + 30) {
digitalWrite(2, HIGH);
digitalWrite(3, HIGH);
digitalWrite(4, HIGH);
}
if (celsius >= baselineTemp + 30) {
digitalWrite(2, HIGH);
digitalWrite(3, HIGH);
digitalWrite(4, HIGH);
}
delay(1000); // Wait for 1000 millisecond(s)
}
4-TOPSHIRIQ
LCD1602 indikatori. Ulanish tamoili, unga axborotni Arduinoda foydalanib chiqarish.
Kodi:
#include
LiquidCrystal LuMi (12, 11, 5, 4, 3, 2);
void setup(){
LuMi.begin(16, 2);
}
void loop() {
LuMi.setCursor(2, 0);
LuMi.print("Ashirbekov Sardor");
LuMi.setCursor(6, 1);
LuMi.print("2023");
delay (2000);
LuMi.clear();
delay (2000);
LuMi.setCursor(6, 0);
LuMi.print("O'rnatilgan tizimlar");
LuMi.setCursor(2, 1);
LuMi.print("Curso Arduino");
delay (2000);
LuMi.clear();
|