Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
recieveController.cpp
- Committer:
 - WAT34
 - Date:
 - 2017-12-07
 - Revision:
 - 5:ccf493e265d1
 - Parent:
 - 4:114dd09583b8
 - Parent:
 - 3:6287618256b5
 
File content as of revision 5:ccf493e265d1:
#include "recieveController.h"
recieveController::recieveController(PinName tx,PinName rx,const uint8_t& id):serial(tx,rx)
{
  id_ = id;
  serial.baud(115200);
  for(int i = 0;i<7;i++)
  {
    buttons[i] = 0;
  }
}
void recieveController::update()
{
  // printf("updating");
  char data[50],*data2,*data3,*button_,*analog[6],*intensity,*bt,*tmpdata;
  serial.gets(data,50);
  // printf("%s",data);
  strtok(data,"-");
  button_ = strtok(NULL,"-");
  analog[0] = strtok(NULL,"-");
  analog[1] = strtok(NULL,"-");
  analog[2] = strtok(NULL,"-");
  analog[3] = strtok(NULL,"-");
  analog[4] = strtok(NULL,"-");
  analog[5] = strtok(NULL,"-");
  intensity = strtok(NULL,"-");
  //printf("%d\n",strtoul(button_,0,16) );
  buttons[0] = strtoul(button_,0,16);
  buttons[1] = strtoul(analog[0],0,16);
  buttons[2] = strtoul(analog[1],0,16);
  buttons[3] = strtoul(analog[2],0,16);
  buttons[4] = strtoul(analog[3],0,16);
  buttons[5] = strtoul(analog[4],0,16);
  buttons[6] = strtoul(analog[5],0,16);
}