Centre de ressources
Heol Robotics


Affichage du code : control_bluetooth.ino

					/* ********************************************************************/
/*  For       : © Heol Robotics - http://heol.io
/*  File      : main.ino
/*  Others    : Based on Arduino library by hackerspace-adelaide    
 *  BT is connected to the Hardware Serial: Pin 0 and 1
/* ********************************************************************/

/* Include XL320 and Software Serial library */
#include 
#include 
#include 

/* Include the file of motors ids and a lot of functions */
#include "heolMotorsIDs.h"
#include "movements.h"

/* Define the ports of the Heol_motors */
/* Heol_Bluetooth use the hardware serial (port 0 and 1) */
SoftwareSerial Heol_motors(10, 11);

/* Init the name of our robot */
XL320 Heol;
{
  /* Start the motor connection with baudrate 9600 */
  Heol_motors.begin(9600);
  Heol.begin(Heol_motors);
  Heol.setJointSpeed(13, 1000);

  /* Start the bluetooth connection with baudrate 115200 */
  Serial.begin(115200);
}

void loop()
{
  /* Check if data is available on the BT Flow */
  if(Serial.available())
    bluetoothData = (char)Serial.read();

  /* Condition on the BT Data */
  switch(bluetoothData)
  {
    case 'a':
      armsUpright();
      break;

    case 'b':
      sayNo(4);
      break;

    case 'd':
      blinkLeds();
      break;

    case 'e':
      standUp();
      break;

    default:
      break;
  }
}				

Centre de ressources © Heol Robotics 2017 - Tous droits réservés