Attached is a schematic of my chicken coop door opener. I am reasonably satisfied with the circuit, and have built and tested a prototype.
I have also written some very rudimentary PICAXE code. While it is functional with the hardware, it is very basic, and I would appreciate constructive criticism.
Thanks.
I have also written some very rudimentary PICAXE code. While it is functional with the hardware, it is very basic, and I would appreciate constructive criticism.
Thanks.
Code:
init:
b1 = 0
main:
readadc 4, b1 'read value on pin 4 into variable b1
if b1>150 and PinC.3=1 then 'if b1 is greater than 150, and SW1 is (normally) closed, then open door
goto open
endif
if b1<150 and PinC.2=1 then 'if b1 is less than 150, and SW2 is (normally) closed, then close door
goto close
else
goto motoroff 'if neither set of conditions is met, turn motor off
endif
goto main
open:
low 0 'disable clockwise rotation
high 1 'turn motor counter-clockwise
goto main
close:
low 1 'disable counter-clockwise rotation
high 0 'turn motor clockwise
goto main
motoroff: 'disable all motor rotation
low 0
low 1
goto main
Attachments
-
24.2 KB Views: 36