servo: removed defines from es08a and made engine move smoothly

Signed-off-by: Kiveisha Yevgeniy <yevgeniy.kiveisha@intel.com>
This commit is contained in:
Kiveisha Yevgeniy
2014-06-12 15:26:01 +00:00
parent 0050f92b06
commit 186dd03b79
5 changed files with 110 additions and 41 deletions

View File

@ -28,38 +28,16 @@
#include <signal.h>
#include <stdlib.h>
int running = 0;
void
sig_handler(int signo)
{
printf("got signal\n");
if (signo == SIGINT) {
printf("exiting application\n");
running = 1;
}
}
int
main(int argc, char **argv)
{
//! [Interesting]
upm::ES08A *servo = new upm::ES08A(5);
signal(SIGINT, sig_handler);
int clock = 0;
while (!running) {
for (int i = 0; i < 18; i++) {
servo->setAngle (clock);
clock += 10;
}
for (int i = 0; i < 18; i++) {
servo->setAngle (clock);
clock -= 10;
}
}
upm::ES08A *servo = new upm::ES08A(5);
servo->setAngle (180);
servo->setAngle (90);
servo->setAngle (0);
servo->setAngle (90);
servo->setAngle (180);
//! [Interesting]
std::cout << "exiting application" << std::endl;