move servo

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
ingoiot
Normal user
Posts: 83
Joined: 15 Aug 2019, 22:09

move servo

#1 Post by ingoiot » 06 Mar 2021, 17:15

hi,

Code: Select all

on touch#Touch do
  servo,1,17,1
  timerSet,1,2      //Set Timer 1 for the next event in 2 seconds
endon

On Rules#Timer=1 do  //When Timer1 expires, do
  servo,1,17,70
  servo,1,17,9000   // servo off(doesnt work)
endon 
adding servo,1,17,9000 prevents servo,1,17,70 to happen.

can i force to run the commands in sequence or do i have to use a timer?

User avatar
Ath
Normal user
Posts: 3416
Joined: 10 Jun 2018, 12:06
Location: NL

Re: move servo

#2 Post by Ath » 06 Mar 2021, 17:19

You have no guaranteed response-time for the servo to move from where it is to '70' so the only usable solution is indeed a timer.
I'd suggest to just time it roughly using a (stop)watch, then doubling that value for the timer value should be fine.
/Ton (PayPal.me)

ingoiot
Normal user
Posts: 83
Joined: 15 Aug 2019, 22:09

Re: move servo

#3 Post by ingoiot » 06 Mar 2021, 19:56

Code: Select all

on touch#Touch do
  servo,1,17,1
  timerSet,1,4      //Set Timer 1 for the next event in 4seconds
endon

On Rules#Timer=1 do  //When Timer1 expires, do
  servo,1,17,70
  timerSet,2,4      //Set Timer 2 for the next event in 4seconds
endon   

On Rules#Timer=2 do  //When Timer2 expires, do
   servo,1,17,9000   // servo off(doesnt work)
endon 
tnx
this works so far.
i hope timers do not block too much.

now if have to figure out much to much false positive touch events..

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 22 guests