Étape 2: Le croquis
Maintenant, nous pouvons charger l’esquisse sur notre Conseil d’administration.
const int pinSwitch = 12 ; Broche Reed
const int pinLed = 9 ; Broche LED
int StatoSwitch = 0 ;
void setup()
{
pinMode (pinLed, sortie) ; Imposto que je broches
pinMode (pinSwitch, entrée) ;
}
void loop()
{
StatoSwitch = digitalRead(pinSwitch) ; Leggo il valore del Reed
Si (StatoSwitch == HIGH)
{
digitalWrite (pinLed, HIGH) ;
}
d’autre
{
digitalWrite (pinLed, basse) ;
}
}