Subversion Repositories shark

Rev

Rev 1481 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

#include "kernel/kern.h"
#include "drivers/shark_keyb26.h"
#include "unistd.h"

#include "servo.h"

#define N_SEND 10000

int main () {

  int res, i = 0, k;

  srand(sys_gettime(NULL));

  cprintf("(Open Com2)");
  res = servo_open(COM2, 19200);
  cprintf("(Res = %d)",res);

  cprintf("(Servo Turn On 0)");
  res = servo_turn_on(COM2, 0);
  cprintf("(Res = %d)",res);

  while(i < N_SEND) {

    cprintf("(Cycle = %d)",i);

    k = rand() % 180 - 90;

    cprintf("(Set Servo 0 %d)",k);
    res = servo_set_angle_sec(COM2, 0, ANGLE2SEC(k,0,0));
    cprintf("(Res = %d)",res);

    udelay(100000);

    i++;

  }

  servo_close(COM2);

  exit(0);

  return 0;

}