Andres Rodriguez
New Member
I want to enter a number between 0 and 15 using 4 dip switches. I attached the schematic and the code which, I think, should work. But there must be a better way. Any sugestions?
Code:
Symbol Zero = b0
Symbol One = b1
Symbol Two = b2
Symbol Three = b3
Symbol Total = b4
Main:
If Pin5 =0 then let Zero=0 else let Zero=1
Endif
If Pin2 =0 then let One=0 else let One=2
Endif
If Pin1 =0 then let Two=0 else let Two=4
Endif
If Pin0 =0 then let Three=0 else let Three=8
Endif
Total= b0+b1+b2+b3
Pause 5000
Goto Main
Attachments
-
16.4 KB Views: 26
Last edited: