Translate
Code Arduino:
Click here to download the code
//Sound Sensor with arduino
// by mohammed.H
//arduino projects
//analog output signal
int soundSensor = 2;
int LED = 7;
bool isLEDOn = false;
void setup()
{
Serial.begin(9600);
pinMode (soundSensor, INPUT);
pinMode (LED, OUTPUT);
digitalWrite( LED,LOW);
}
void loop()
{
int statusSensor = digitalRead (soundSensor);
if (statusSensor == 1)
{
Serial.println("ON");
if( isLEDOn == false){
isLEDOn = true;
digitalWrite(LED, HIGH);
}
else{
isLEDOn = false;
digitalWrite(LED, LOW);
}
}
else
{
Serial.println("zzz");
}
}
Click here to download the code
//Sound Sensor with arduino
// by mohammed.H
//arduino projects
//analog output signal
int soundSensor = 2;
int LED = 7;
bool isLEDOn = false;
void setup()
{
Serial.begin(9600);
pinMode (soundSensor, INPUT);
pinMode (LED, OUTPUT);
digitalWrite( LED,LOW);
}
void loop()
{
int statusSensor = digitalRead (soundSensor);
if (statusSensor == 1)
{
Serial.println("ON");
if( isLEDOn == false){
isLEDOn = true;
digitalWrite(LED, HIGH);
}
else{
isLEDOn = false;
digitalWrite(LED, LOW);
}
}
else
{
Serial.println("zzz");
}
}
See the results and how to connect with Arduino in the Video below :
https://www.youtube.com/watch?v=4r8hg7A1sSU
Inscription à :
Publier les commentaires (Atom)
Aucun commentaire:
Enregistrer un commentaire