Richard Sewell
/
ucam
This is the code we showed at Uncraftivism
Diff: ServoMinder.cpp
- Revision:
- 1:70d90598d2e7
- Parent:
- 0:57f4fdadc97f
- Child:
- 2:01115080f6da
--- a/ServoMinder.cpp Fri Nov 20 14:40:48 2009 +0000 +++ b/ServoMinder.cpp Thu Dec 10 21:16:57 2009 +0000 @@ -19,9 +19,19 @@ m_ticker.attach( this, &ServoMinder::tick, m_tickTime ); } +void ServoMinder::moveToAndWait( float target ) +{ + moveTo( target ); + + while( fabs( m_servo->read() - m_target) > m_delta ) + wait( 0.001 ) ; + } + void ServoMinder::moveTo( float target ) { + m_target = target; + }