A simple question but I cannot find an answer in the forum. Using the Arduino Mega and a simple pushbutton or switch.
I need to add a pushbutton to my project and code it like this:
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
Releasing the button would then stop the motor. I think I have to be carefull not to block the main thread.
The point of this is to move a horizontal arm slowly downwards to set the position of a mechanical end switch, clients request.
How can I code this? Suggestions please.
Thank you.
			
			I need to add a pushbutton to my project and code it like this:
			
				B4X:
			
		
		
		While Pushbutton is being pressed
'Do this
turn on motor and move accordingly
endReleasing the button would then stop the motor. I think I have to be carefull not to block the main thread.
The point of this is to move a horizontal arm slowly downwards to set the position of a mechanical end switch, clients request.
How can I code this? Suggestions please.
Thank you.
 
				 
 
		 
 
		 
 
		 
 
		 
 
		