/* program to determine the battery charge on a Scribbler 2 robot
 *
 * This program and all MyroC software is licensed under the Creative Commons
 * Attribution-Noncommercial-Share Alike 3.0 United States License.
 * Details may be found at http://creativecommons.org/licenses/by-nc-sa/3.0/us/
 */

#include <stdio.h>
#include "MyroC.h"

int main ()
{
  printf ("test of getBattery function\n");

  rSetBluetoothEcho ('n');

  //char * robot = "/dev/tty.IPRE6-365897-DevB";
  char * robot = "/dev/tty.Fluke2-0950-Fluke2";
  rConnect (robot);  

  /* use rBeep to get echo of sensor data */
  rBeep (1.0, 880);

  printf ("testing battery sensor for %s\n", robot);
  printf ("\treported value:  %lf\n", rGetBattery ());

  /* wrap up with rGetName, to be sure communication in sync */
  printf ("finishing up with robot %s\n", robot);
  rDisconnect ();
 
  robot = "/dev/tty.Fluke2-0950-Fluke2";
  rConnect (robot);  

  /* use rBeep to get echo of sensor data */
  rBeep (1.0, 880);

  printf ("testing battery sensor for %s\n", robot);
  printf ("\treported value:  %lf\n", rGetBattery ());

  /* wrap up with rGetName, to be sure communication in sync */
  printf ("finishing up with robot %s\n", robot);


  rDisconnect ();
  printf ("test completed\n");
  return 0;

}
