pwm.cpp
00001
00002
00003
00004
00005
00006
00007 #include "runCtrl.h"
00008 #include <stdio.h>
00009 #include <stdlib.h>
00010
00011
00012 int main(int argc, char *argv[]) {
00013 try {
00014 RunCtrl run;
00015 if (run.connect(argc, argv) < 0) {
00016 printf("RunCtrl::connect: %s\n", run.what());
00017 exit(1);
00018 }
00019
00020 enum { MotorID = 0 };
00021 run.setMotorMode(MotorID, CW);
00022 for (int i = 0; i <= 255; ++i) {
00023 run.setMotorPwm(MotorID, i);
00024 VXV::Delay(50);
00025 int enc_vel = 0;
00026 run.getEncoderVel(MotorID, &enc_vel);
00027 printf("%d\t%d\n", i, enc_vel);
00028 }
00029 run.setMotorPwm(MotorID, 0);
00030
00031 } catch (std::exception& e) {
00032 printf("exception:: %s\n", e.what());
00033 }
00034
00035 return 0;
00036 }
00037