Stap 10: Programma Arduino.
Hier is de code:
Const int vinger = 8;
Const int palm = 5;
Const int knop = 13;
Const int empin = 10;
int buttonstate = 0;
int sensorstate = 0;
VOID Setup {}
pinMode (button, INPUT);
pinMode (vinger, uitvoer);
pinMode (palm, INPUT);
pinMode (empin, OUTPUT);
}
void loop {}
digitalWrite (palm, hoge);
buttonstate = digitalRead(button);
sensorstate = digitalRead(finger);
Als (buttonstate == HIGH) {}
Als (sensorstate == LOW) {}
digitalWrite (empin, hoge);
}
}
else {}
digitalWrite (empin, laag);
}
}