Stap 2: De schets
We kunnen nu de schets laden op ons bord.
Const int pinSwitch = 12; PIN Reed
Const int pinLed = 9; Pin LED
int StatoSwitch = 0;
VOID Setup
{
pinMode (pinLed, OUTPUT); Imposto die ik PIN
pinMode (pinSwitch, INPUT);
}
void loop
{
StatoSwitch = digitalRead(pinSwitch); Leggo il stabilimento del Reed
Als (StatoSwitch == HIGH)
{
digitalWrite (pinLed, hoge);
}
anders
{
digitalWrite (pinLed, laag);
}
}