Serial begin(9600); // seriyani ishga tushiring pinMode(touch sensor pin, input); // kontroller pinini kirish rejimiga o'rnating pinMode


Download 13.94 Kb.
Sana15.06.2023
Hajmi13.94 Kb.
#1487031
Bog'liq
const int TOUCH DGU


const int TOUCH_SENSOR_PIN = 7; // kontrollerning pin oyoqchasiga sensorni tanishtirish


const int BUZZER_PIN = 3; // kontrollerning pin oyoqchasiga tovush qurulmasini tanishtirish

void setup() {


Serial.begin(9600); // seriyani ishga tushiring
pinMode(TOUCH_SENSOR_PIN, INPUT); // kontroller pinini kirish rejimiga o'rnating
pinMode(BUZZER_PIN, OUTPUT); // kontroller pinini chiqish rejimiga o'rnating
}
void loop() {
int touchState = digitalRead(TOUCH_SENSOR_PIN); // Holatni o‘qish

if (touchState == HIGH) {


Serial.println("Sensorga kirish signali berilmoqda");;
digitalWrite(BUZZER_PIN, HIGH); // Ovoz qurulmasi yoqish
}
else
if (touchState == LOW) {
Serial.println("Sensor tinch xolatda");
digitalWrite(BUZZER_PIN, LOW); // Ovoz qurulmasini o’chirish
}
}
Download 13.94 Kb.

Do'stlaringiz bilan baham:




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling