Re: how to read ky40 mechanical encoder ?
CAUTION: UNTESTED CODE
Code:
main:
A var portb.6
B var portb.7
state var byte
if(( A == 1)&&(B==1)) then state = 1
if(( A == 1)&&(B==0)) then state = 2
if(( A == 0)&&(B==1)) then state = 3
if(( A == 0)&&(B==0)) then state = 4
;pause 100
if state = 1 then portC = %00000001
if state = 2 then portc = %00000010
if state = 3 then portc = %00000100
if state = 4 then portc = %00001000
debug " state = ",#state
goto main
If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
.
Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
.
There simply is no "Happy Spam" If you do it you will disappear from this forum.
Bookmarks