Dependents:   RobotBase

Robot.cpp

Committer:
inst
Date:
2015-08-21
Revision:
1:48028dcad4e2
Parent:
0:91d31b26ae9e
Child:
2:0d9bb8e1876b

File content as of revision 1:48028dcad4e2:

#include "mbed.h"
#include "Robot.h"
#include "I2CDevice.h"

// Steering : I2CMotor * 4, I2CServo * 4    ----  8
// ShootingSystem : I2CServo * 2            ----  2
// XBee : XBee * 1                          ----  1
// Shooter: Shooter * 1                     ----  1
const int Robot::mNumOfI2CDevice = 12;

void Robot::update(){
    readI2CDevice();
    updateAction();
    writeI2CDevice();
}

void Robot::writeI2CDevice(){
    for ( int i = 0; i < mNumOfI2CDevice; ++i ){
        mI2CDevice[ i ]->write();
    }
}

void Robot::readI2CDevice(){
    for ( int i = 0; i < mNumOfI2CDevice; ++i ){
        mI2CDevice[ i ]->read();
    }
}