From 2fce7369f4820a961017fc36355d52086f80c0ca Mon Sep 17 00:00:00 2001 From: Sarah Knepper Date: Thu, 22 Jan 2015 20:09:51 -0800 Subject: [PATCH] es08a: Add comments, output, and one-second sleeps to C++ example Signed-off-by: Sarah Knepper --- examples/es08a.cxx | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/examples/es08a.cxx b/examples/es08a.cxx index 6abcb07e..3f7e5c46 100644 --- a/examples/es08a.cxx +++ b/examples/es08a.cxx @@ -33,13 +33,25 @@ main(int argc, char **argv) { //! [Interesting] upm::ES08A *servo = new upm::ES08A(5); - servo->setAngle (180); - //! [Interesting] - servo->setAngle (90); - servo->setAngle (0); - servo->setAngle (90); + // Sets the shaft to 180, then to 90, then to 0, + // then back to 90, and finally back to 180, + // pausing for a second in between each angle servo->setAngle (180); + std::cout << "Set angle to 180" << std::endl; + sleep(1); + servo->setAngle (90); + std::cout << "Set angle to 90" << std::endl; + sleep(1); + servo->setAngle (0); + std::cout << "Set angle to 0" << std::endl; + sleep(1); + servo->setAngle (90); + std::cout << "Set angle to 90" << std::endl; + sleep(1); + servo->setAngle (180); + std::cout << "Set angle to 180" << std::endl; + //! [Interesting] std::cout << "exiting application" << std::endl;