Using Tenda "busy" signal to control servo program

Pat13

Senior Member
I have 3 servos that are moving randomly, using multitasking on an 08M2. What I want to do is have the servos go to a subroutine when the Tenda busy signal goes low. However, I only want them to go to the subroutine the first four times the Tenda goes low, and ignore the rest of the busy signals until a specific time has passed, (up to two minute) at which time they will wait for the busy pin to go low again, and repeat. I have looked at the if..elseif but I'm not sure...
 

westaust55

Moderator
For monitoring the time duration there is the system word variable TIME available on the M2 parts which increments at 1 second intervals .
You can use that to determine when 2 minutes (= 3600 seconds ) or any other period has expired.

If you only wish to perform the subroutine for the first 4 times in any 2 minute period then set up a counter using a byte variable.
Each time the subroutine is entered increment the counter.
Then your test can use an IF&#8230;THEN to call the subroutine where counter is < 4 and TIME < 3600.
When time reaches 2 minutes, then you can reset both the timer and counter.


I have 3 servos that are moving randomly, using multitasking on an 08M2.
Not 100% clear how/what your multitasking approach is being used for withr espect to the servos.
However, as variables, RAM and EEPROM are shared between the multiple tasks, if the servos are controlled under different tasks,
the same methodology can be used to monitor the time and number of times the subroutines have been called within each task.
 
Top