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