Voici le programme
/*macro definitions of magnetic pin and LED pin*/
#define MAGNECTIC_SWITCH 9
#define LED 13//the on board LED of the Arduino or Seeeduino
void setup()
{
pinMode(MAGNECTIC_SWITCH, INPUT);
pinMode(LED,OUTPUT);
}
void loop()
{
if(isNearMagnet())//if the magnetic switch is near the magnet?
{
digitalWrite(LED,HIGH);
}
else
{
digitalWrite(LED,LOW);
}
}
/*If the magnetic switch is near the magnet, it will return ture, */
/*otherwise it will return false */
boolean isNearMagnet()
{
int sensorValue = digitalRead(MAGNECTIC_SWITCH);
if(sensorValue == HIGH)//if the sensor value is HIGH?
{
return true;//yes,return ture
}
else
{
return false;//no,return false
}
}
Je redemande de l'aide car j'ai essayer plein de chose mais sa marche toujours pas , j'aimerais que quand il a 5 fois un 1 sur la broche 9 ( le magnatic switch) en 30s j'allume la broche 13 alors si vous avez des idée je suis preneur !