Und da ich nicht weiss, ob jurs hier mitliest:
public class Kamera {
byte f;
byte s;
const byte focusVorlauf = 10;
const byte Nachlauf = 10;
public:
Kamera ( byte focusPin, byte shutterPin ) {
f = focusPin;
s = shutterPin;
pinMode(f, OUTPUT);
pinMode(s, OUTPUT);
}
take ( unsigend long basetime, int shutter ) {
int reltime = millis() - basetime;
if (reltime > (shutter - focusVorlauf) && reltime < shutter + Nachlauf) {
digitalWrite(f, HIGH);
if ( reltime > shutter) ; digitalWrite(s, HIGH);
} else {
digitalWrite(f, LOW);
digitalWrite(s, LOW);
}
}
};
Probier mal, das als Vorlage für eine class Ventil zu nehmen.
Und finde zuerst raus, warum es noch nicht ganz geht ... (na, weil es nicht getestet ist )