View Full Version : 6 Buttons
Johansch
- 3rd July 2007, 12:56
Hi,
I need to complile a program with 6 buttons lets say it's connected from portb0-5. When the user press button 1345 the code must send out serial 134&5. I'm still new with picbasic and I just don't know where to start?
Any help
Thanks
skimask
- 3rd July 2007, 13:37
Hi,
I need to complile a program with 6 buttons lets say it's connected from portb0-5. When the user press button 1345 the code must send out serial 134&5. I'm still new with picbasic and I just don't know where to start?
Any help
Thanks
Start with hooking up some buttons and getting an LED to respond to a button press...
mister_e
- 3rd July 2007, 23:42
a bit far of what you need to do... but you may find some tricks in it...
Combination Gate Access
http://www.picbasic.co.uk/forum/showthread.php?t=5695&highlight=gate+operator
Enjoy!
Johansch
- 4th July 2007, 15:21
Thanks for that many info, but I think that is way over my head I'm only in my second week in picbasic and also doing it part time.
The code I started is like this for 4 buttons
Include "16f84a.inc"
Key1 var byte
Key2 var byte
Key3 var byte
Key4 var byte
Start: if portb.0 = 1 then key1 = 0
if portb.1 = 1 then key2 = 1
if portb.2 = 1 then key3 = 2
if portb.3 = 1 then key4 = 3
if porta.0 = 1 then Sout
goto start
Sout:
high 7
serout porta.4,N2400,[#key1,#key2,#key3,#key4]
clear
goto start
I did use the button function and I get the same result as the one above, the problem is that the code do send serout 0123 format, yes I know I set that up that way for serout, but I need to send it out in the sequence the buttons was pressed say for example 0231 or lets say there was a button that was pressed twice "0122", this is where I don’t know how to set that up
Thanks for all the help !
Powered by vBulletin® Version 4.1.7 Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.