summaryrefslogtreecommitdiff
path: root/mesecons_luacontroller/examples/rslatch.lua
blob: 12573962c76cc57b717d2e98760dc5a1bfd490b3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
--R/S Latch
--When S is active, Q turns on.
--When R is active, Q turns off.
--/Q is always the opposite of Q.

--Pin Assignments:
-- S: Pin A
-- R: Pin B
-- Q: Pin C
--/Q: Pin D

if pin.a then
	port.c = true
elseif pin.b then
	port.c = false
end

port.d = not port.c