The code below is a handler working in OrangePi - turning traffic lights on and off.
The problem is that it works only in debug mode. When run in Release the handle sub is done but the timer doesn't tick !
When activating the jar in the OrangePi directly it doesn't work also.
Why ???
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
			
			The problem is that it works only in debug mode. When run in Release the handle sub is done but the timer doesn't tick !
When activating the jar in the OrangePi directly it doesn't work also.
Why ???
			
				B4X:
			
		
		
		'Handler class
Sub Class_Globals
    Public tmr As Timer
    Private state As Int = 0
End Sub
Public Sub Initialize
    tmr.Initialize("tmr",1000)
End Sub
Sub Handle(req As ServletRequest, resp As ServletResponse)
    Main.gp.DefinePin("PA11", True)
    Main.gp.DefinePin("PA12", True)
    Main.gp.DefinePin("PA13", True)
    Main.gp.WritePin("PA11",True)
    tmr.Enabled = True
End Sub
Sub tmr_tick
    state = (state + 1) mod 7
    Log(state)
    Select state
        Case 0                              ' red
            Main.gp.WritePin("PA11",True)
            Main.gp.WritePin("PA12",False)
            Main.gp.WritePin("PA13",False)
        Case 1
       
        Case 2
       
        Case 3
            Main.gp.WritePin("PA12",True)  ' + yellow
        '    Main.gp.WritePin("PA11",False)
        Case 4                             ' green
            Main.gp.WritePin("PA13",True)
            Main.gp.WritePin("PA12",False)
            Main.gp.WritePin("PA11",False)
        Case 5
                   
        Case 6
            Main.gp.WritePin("PA12",True)
            Main.gp.WritePin("PA13",False)
           
    End Select
End Sub
			
				Last edited: 
			
		
	
								
								
									
	
								
							
							 
				 
 
		 
 
		 
 
		 
 
		 
 
		 
 
		