Buttons


Closed Thread
Results 1 to 7 of 7

Thread: Buttons

Hybrid View

  1. #1
    Join Date
    May 2008
    Location
    Texas
    Posts
    16


    Did you find this post helpful? Yes | No

    Default aha

    One step ahead of you good sir

    I was able to read temp and actually write in a setpoint that turned on a green LED when temp was over setpoint and a red one when below.

    so maybe two steps

    You think I should use the button command to send the program to a subroutine that loops as long as the button is pushed? This way if you want to increase the temp by say ten you can just hold it down.

    Later
    Bryan

  2. #2
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by WarPony View Post
    You think I should use the button command to send the program to a subroutine that loops as long as the button is pushed? This way if you want to increase the temp by say ten you can just hold it down.
    Hi, Bryan

    looks pretty good that way ...

    and also works pretty good with the BUTTON command which is really ideal for such use ...

    Alain
    Last edited by Acetronics2; - 15th May 2008 at 16:07.
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  3. #3
    Join Date
    May 2008
    Location
    Texas
    Posts
    16


    Did you find this post helpful? Yes | No

    Default

    Thanks Alain

    I am just starting to wrap my head around this stuff

  4. #4
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Lightbulb

    Hi,

    I knew there was an example in my projects ...

    Code:
    '*****************************************************************************
    mainloop:
    
    Writeok = 0
    
    delay = 0
    
    button Up, 		0, 255, 0, delay, 1, upbutton
    button Down, 	0, 255, 0, delay, 1, dwnbutton
    button Prog, 	0, 255, 0, delay, 1, Program
    
    Gosub Outsig
    PAUSE 18
    compte = 0
    
    Goto Mainloop
    
    
    '*****************************************************************************
    upbutton:
    
    IF Down = 0 THEN 
    
    	Pos = posn
    	Goto Jump1
    	
    Endif
    
    	Compte = compte + 1
    	
    	Select Case Compte
    	
    		Case 255
    			Compte = Compte-1
    			N = 10
    			
    		Case is > 50
    			N = 10
    				
    		Case is > 15 
    		 	N = 3
    		 	
    		Case else
    			N = 1
    			
    	End Select
    	
       	pos = pos + 2*N
       
       	if pos > 2250 then  pos = 2250
      
    Jump1:
    
    For delay = 1 to 9	
    
    	Gosub Outsig
    	Pause 18
    
    Next delay
    
    	Gosub Outsig
    
    Goto mainloop
    
    
    '*****************************************************************************
    dwnbutton:
    
    IF Up = 0 THEN 
    
    	Pos = posn
    	Goto Jump2
    	
    Endif
    
    	Compte = compte + 1
    	
    	Select Case Compte
    	
    		Case 255
    			Compte = Compte - 1
    			N = 10
    			
    		Case is > 50
    			N = 10
    			
    		Case is > 10 
    		 	N = 3
    		 			
    		Case else
    			N = 1
    			
    	End Select
    	
       	pos = pos - 2*N
       
       	if pos < 750 then pos = 750
       	 
    Jump2:
    	
    For delay = 1 to 9	
    
    	Gosub Outsig
    	Pause 18
    
    Next delay
    
    	Gosub Outsig
    
     Goto mainloop
     
    
    '*****************************************************************************
    Program:
    
    Compte = 0
    
    Test: 
    
    IF Prog = 0 Then 
    	
    	compte = compte + 1
    	Gosub Outsig
    	Pause 18
    	
    	IF Compte > 250 THEN Compte = 250: Goto Test
    	IF Compte >= 80 THEN WriteoK = Compte .4 : Goto Test
    	IF Compte >= 20 THEN WriteoK = Compte .2
    	
    	Goto Test		'Attendre relāchement bouton ...
    	
    Endif	
    	
    	IF Compte > 250 OR Compte < 20 Then mainloop
    	
    	IF Compte >= 80 Then
    	 
    		pos = 1500 
    		Goto Save	'remise au Neutre
    
    	Endif
    NB : WriteOk is the led that shows where you are ...
    Outsig is generating a servo pulse ...

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  5. #5
    Join Date
    May 2008
    Location
    Texas
    Posts
    16


    Did you find this post helpful? Yes | No

    Default

    ty alain

    I am going to use your example instead of pbp manual on this one. I am almost there

    Bryan

Similar Threads

  1. In Circut Debug (ICD) buttons palet is disable for 18F2620
    By muskut in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 17th June 2010, 05:21
  2. Button command question
    By aherrera in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 31st August 2009, 08:44
  3. 6 Buttons
    By Johansch in forum General
    Replies: 3
    Last Post: - 4th July 2007, 15:21
  4. Buttons are driving me nuts
    By Doormatt in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 21st May 2007, 23:09
  5. Latched buttons
    By peu in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 25th January 2006, 00:22

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts