/***************************************************
     hb-midilib-lcd.c
     Realtime MIDI Library for the MIT HandyBoard
     colby leider (cnl@dartmouth.edu)
     last updated 9.16.97

     http://music.dartmouth.edu/~colby/hb.html
 
     test_motors() by Dr. Fred Martin, MIT
***************************************************/



/* display_analogs:
        displays the current values of the inputs to the analog
        ports on the LCD until the Handy Board's stop button is
        pressed */
/***************************************************************/
void
display_analogs()
{
   while (!stop_button()) {
      printf("\n%d %d %d %d %d %d %d", knob(), analog(0), analog(1), analog(2), analog(3), analog(4), analog(5), analog(6));
   }
}


/* display_digitals:
        displays the current values of the inputs to the digital
        ports on the LCD until the Handy Board's stop button is
        pressed */
/***************************************************************/
void
display_digitals()
{
    while (!stop_button()) {
        printf("\n%d %d %d %d %d %d %d %d %d", digital(7), digital(8), digital(9), digital(10), digital(11), digital(12), digital(13), digital(14), digital(15));
        msleep(25L);
    }
}


/* test_motors:
        (by Fred Martin)
        sequentially turns each motor connected to the Handy
        Board's motor ports forward and backward */
/***************************************************************/
void
test_motors(void)
{
  while (1) {
    int i;
    for (i= 0; i< 4; i++) {
      fd(i); msleep(250L);
      bk(i); msleep(250L);
      off(i);
    }
  }
}


/* test_ir:
        continually displays received values from Sony-
        compatiable remote control on the LCD.  before calling
        test_ir(), the file sony-ir.icb (available at the Handy
        Board home page) must be loaded. */
/***************************************************************/
void
test_ir()
{
   int value;
   sony_init(1);
   while (!stop_button())
    {
       value = ir_data(1);
       printf("\n%d", value);
       if (value) msleep(400L);
       else msleep(100L);
    }
}

