الخميس، 14 مارس 2019

Capteur de flamme Arduino | Détecteur d’incendie projet


matériel :

Arduino UNO
Capteur de flamme
LED
Avertisseur sonore
BreadBoard
Sauteurs

code :

//Viral Science www.youtube.com/c/viralscience
//Arduino Flame Sensor
const int buzzerPin = 12;
const int flamePin = 11;
int Flame = HIGH;
int redled = 5;
int greenled = 6;
void setup() 
{
pinMode(buzzerPin, OUTPUT);
pinMode(redled, OUTPUT);
pinMode(greenled, OUTPUT);
pinMode(flamePin, INPUT);
Serial.begin(9600);
}
void loop() 
{
Flame = digitalRead(flamePin);
if (Flame== LOW)
{
digitalWrite(buzzerPin, HIGH);
digitalWrite(redled, HIGH);
digitalWrite(greenled, LOW);
}
else
{
digitalWrite(buzzerPin, LOW);
digitalWrite(greenled, HIGH);
digitalWrite(redled, LOW);
}
}

ليست هناك تعليقات:

إرسال تعليق