Automatische Geragentorverrigelung/-öffnung
Wisser: Skruppy
Mitwisser:
Status: in progress
Tags: elektro, software, AVR, C
4-Fach OP-Verstärker:
KIA324P 8C
Komplette Platine analog ⇒ Lampe als Schnitstelle zu mC verwenden + Helligkeitssensor abzicken (dunkel machen) [oder im gehäuse lassen und wieder abkleben]
setState(state) { switch(state) { unlocked: disableIsr(unlockSwitch/ir); enableIsr(door); break; locked: enableIsr(unlockSwitch/ir); disableIsr(door); break; } } ISR(unlockSwitch/ir) { setState(unlocked); } ISR(door) { setState(unlocked); setLed(); } //////////////////////////////////////////////////////////// // Detect current peak // //////////////////////////////////////////////////////////// // Find a rising edge (the same as the code below) (rising edge has to be detected before falling ege to prevent detection of the power on current) // Find a falling edge while(true) { if(adx >= error) { stop(); } else if(adc > max) { max = adc; th = adc; } else if(adc < th) { if(th == max) { th *= 0.9; } else { stop(); } } }